@@ -1103,48 +1103,53 @@ describe('CSSStyleRule', () => {
11031103
11041104 const styleSheet = createStyleSheet ( `
11051105 style {
1106+ @media {
1107+ nested {}
1108+ nested & {}
1109+ > nested & {}
1110+ }
11061111 @scope {
11071112 scoped {
11081113 nested {}
11091114 }
11101115 }
1111- nested {}
11121116 color: green;
11131117 }
11141118 ` )
11151119 const styleRule = styleSheet . cssRules [ 0 ]
1116- const { cssRules : [ scopeRule , nestedStyleRule ] } = styleRule
1120+ const { cssRules : [ mediaRule , scopeRule ] } = styleRule
1121+ const nestedStyleRule = mediaRule . cssRules [ 0 ]
11171122 const scopedStyleRule = scopeRule . cssRules [ 0 ]
11181123
11191124 // CSSRule
1120- assert . equal ( styleRule . cssText , 'style { @scope { scoped { & nested {} } } & nested {} color: green; }' )
1121- assert . equal ( scopedStyleRule . cssText , 'scoped { & nested {} }' )
1125+ assert . equal ( styleRule . cssText , 'style { @media { & nested {} nested & {} & > nested & {} } @scope { scoped { & nested {} } } color: green; }' )
11221126 assert . equal ( nestedStyleRule . cssText , '& nested {}' )
1127+ assert . equal ( scopedStyleRule . cssText , 'scoped { & nested {} }' )
11231128 assert . equal ( styleRule . parentRule , null )
1129+ assert . equal ( nestedStyleRule . parentRule , mediaRule )
11241130 assert . equal ( scopedStyleRule . parentRule , scopeRule )
1125- assert . equal ( nestedStyleRule . parentRule , styleRule )
11261131 assert . equal ( styleRule . parentStyleSheet , styleSheet )
1127- assert . equal ( scopedStyleRule . parentStyleSheet , styleSheet )
11281132 assert . equal ( nestedStyleRule . parentStyleSheet , styleSheet )
1133+ assert . equal ( scopedStyleRule . parentStyleSheet , styleSheet )
11291134
11301135 // CSSGroupingRule
11311136 assert . equal ( CSSRuleList . is ( styleRule . cssRules ) , true )
1132- assert . equal ( CSSRuleList . is ( scopedStyleRule . cssRules ) , true )
11331137 assert . equal ( CSSRuleList . is ( nestedStyleRule . cssRules ) , true )
1138+ assert . equal ( CSSRuleList . is ( scopedStyleRule . cssRules ) , true )
11341139
11351140 // CSSStyleRule
11361141 assert . equal ( styleRule . selectorText , 'style' )
1137- assert . equal ( scopedStyleRule . selectorText , 'scoped' )
11381142 assert . equal ( nestedStyleRule . selectorText , '& nested' )
1143+ assert . equal ( scopedStyleRule . selectorText , 'scoped' )
11391144 styleRule . selectorText = 'parent'
1140- scopedStyleRule . selectorText = 'scoped-parent'
11411145 nestedStyleRule . selectorText = 'child'
1146+ scopedStyleRule . selectorText = 'scoped-parent'
11421147 assert . equal ( styleRule . selectorText , 'parent' )
1143- assert . equal ( scopedStyleRule . selectorText , 'scoped-parent' )
11441148 assert . equal ( nestedStyleRule . selectorText , '& child' )
1149+ assert . equal ( scopedStyleRule . selectorText , 'scoped-parent' )
11451150 assert . equal ( CSSStyleProperties . is ( styleRule . style ) , true )
1146- assert . equal ( CSSStyleProperties . is ( scopedStyleRule . style ) , true )
11471151 assert . equal ( CSSStyleProperties . is ( nestedStyleRule . style ) , true )
1152+ assert . equal ( CSSStyleProperties . is ( scopedStyleRule . style ) , true )
11481153 } )
11491154 test ( 'methods' , ( ) => {
11501155
0 commit comments