Skip to content

Commit f737598

Browse files
committed
Add test for invalid namespace in nested rule prelude
This test was failing before the previous commit because a new context was created for each CSS*Rule created, before parsing its block value.
1 parent bb27bba commit f737598

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

__tests__/stylesheet.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,16 @@ describe('CSS grammar - semantic', () => {
22992299
expect(styleSheet.cssRules[0].cssText).toBe(normalizeText(input))
23002300
})
23012301
})
2302+
test('nested style rule - invalid prelude containing an undeclared namespace prefix', () => {
2303+
const styleSheet = createStyleSheet(`
2304+
@namespace svg "http://www.w3.org/2000/svg";
2305+
style {
2306+
html|nested {}
2307+
svg|nested {}
2308+
}
2309+
`)
2310+
expect(styleSheet.cssRules[1].cssText).toBe('style { & svg|nested {} }')
2311+
})
23022312
test('nested style rule - invalid block contents', () => {
23032313
const styleSheet = createStyleSheet(`
23042314
style {

0 commit comments

Comments
 (0)