-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update css nesting stuff to match the latest spec
- Loading branch information
Showing
9 changed files
with
359 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -700,18 +700,71 @@ func TestCSSExternalQueryAndHashMatchIssue1822(t *testing.T) { | |
func TestCSSNestingOldBrowser(t *testing.T) { | ||
css_suite.expectBundled(t, bundled{ | ||
files: map[string]string{ | ||
"/entry.css": ` | ||
a { &:hover { color: red; } } | ||
`, | ||
"/[email protected]": `a { @layer base { color: red; } }`, | ||
"/[email protected]": `a { @media screen { color: red; } }`, | ||
"/nested-ampersand.css": `a { &, & { color: red; } }`, | ||
"/nested-attribute.css": `a { [href] { color: red; } }`, | ||
"/nested-colon.css": `a { :hover { color: red; } }`, | ||
"/nested-dot.css": `a { .cls { color: red; } }`, | ||
"/nested-greaterthan.css": `a { > b { color: red; } }`, | ||
"/nested-hash.css": `a { #id { color: red; } }`, | ||
"/nested-plus.css": `a { + b { color: red; } }`, | ||
"/nested-tilde.css": `a { ~ b { color: red; } }`, | ||
|
||
"/toplevel-ampersand.css": `a { &, & { color: red; } }`, | ||
"/toplevel-attribute.css": `a { [href] { color: red; } }`, | ||
"/toplevel-colon.css": `a { :hover { color: red; } }`, | ||
"/toplevel-dot.css": `a { .cls { color: red; } }`, | ||
"/toplevel-greaterthan.css": `a { > b { color: red; } }`, | ||
"/toplevel-hash.css": `a { #id { color: red; } }`, | ||
"/toplevel-plus.css": `a { + b { color: red; } }`, | ||
"/toplevel-tilde.css": `a { ~ b { color: red; } }`, | ||
}, | ||
entryPaths: []string{ | ||
"/[email protected]", | ||
"/[email protected]", | ||
"/nested-ampersand.css", | ||
"/nested-attribute.css", | ||
"/nested-colon.css", | ||
"/nested-dot.css", | ||
"/nested-greaterthan.css", | ||
"/nested-hash.css", | ||
"/nested-plus.css", | ||
"/nested-tilde.css", | ||
|
||
"/toplevel-ampersand.css", | ||
"/toplevel-attribute.css", | ||
"/toplevel-colon.css", | ||
"/toplevel-dot.css", | ||
"/toplevel-greaterthan.css", | ||
"/toplevel-hash.css", | ||
"/toplevel-plus.css", | ||
"/toplevel-tilde.css", | ||
}, | ||
entryPaths: []string{"/entry.css"}, | ||
options: config.Options{ | ||
Mode: config.ModeBundle, | ||
AbsOutputFile: "/out.css", | ||
AbsOutputDir: "/out", | ||
UnsupportedCSSFeatures: compat.Nesting, | ||
OriginalTargetEnv: "chrome10", | ||
}, | ||
expectedScanLog: `entry.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
expectedScanLog: `[email protected]: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
[email protected]: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-ampersand.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-attribute.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-colon.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-dot.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-greaterthan.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-hash.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-plus.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
nested-tilde.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-ampersand.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-attribute.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-colon.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-dot.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-greaterthan.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-hash.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-plus.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
toplevel-tilde.css: WARNING: CSS nesting syntax is not supported in the configured target environment (chrome10) | ||
`, | ||
}) | ||
} | ||
|
@@ -802,6 +855,5 @@ func TestDeduplicateRules(t *testing.T) { | |
AbsOutputDir: "/out", | ||
MinifySyntax: true, | ||
}, | ||
expectedScanLog: "no0.css: WARNING: CSS nesting syntax cannot be used outside of a style rule\n", | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,10 +180,148 @@ console.log(void 0); | |
|
||
================================================================================ | ||
TestCSSNestingOldBrowser | ||
---------- /out.css ---------- | ||
/* entry.css */ | ||
---------- /out/[email protected] ---------- | ||
/* [email protected] */ | ||
a { | ||
@layer base { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/[email protected] ---------- | ||
/* [email protected] */ | ||
a { | ||
@media screen { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-ampersand.css ---------- | ||
/* nested-ampersand.css */ | ||
a { | ||
&, | ||
& { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-attribute.css ---------- | ||
/* nested-attribute.css */ | ||
a { | ||
[href] { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-colon.css ---------- | ||
/* nested-colon.css */ | ||
a { | ||
:hover { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-dot.css ---------- | ||
/* nested-dot.css */ | ||
a { | ||
.cls { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-greaterthan.css ---------- | ||
/* nested-greaterthan.css */ | ||
a { | ||
> b { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-hash.css ---------- | ||
/* nested-hash.css */ | ||
a { | ||
#id { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-plus.css ---------- | ||
/* nested-plus.css */ | ||
a { | ||
+ b { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/nested-tilde.css ---------- | ||
/* nested-tilde.css */ | ||
a { | ||
~ b { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-ampersand.css ---------- | ||
/* toplevel-ampersand.css */ | ||
a { | ||
&, | ||
& { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-attribute.css ---------- | ||
/* toplevel-attribute.css */ | ||
a { | ||
[href] { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-colon.css ---------- | ||
/* toplevel-colon.css */ | ||
a { | ||
:hover { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-dot.css ---------- | ||
/* toplevel-dot.css */ | ||
a { | ||
.cls { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-greaterthan.css ---------- | ||
/* toplevel-greaterthan.css */ | ||
a { | ||
> b { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-hash.css ---------- | ||
/* toplevel-hash.css */ | ||
a { | ||
#id { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-plus.css ---------- | ||
/* toplevel-plus.css */ | ||
a { | ||
+ b { | ||
color: red; | ||
} | ||
} | ||
|
||
---------- /out/toplevel-tilde.css ---------- | ||
/* toplevel-tilde.css */ | ||
a { | ||
&:hover { | ||
~ b { | ||
color: red; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.