File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,8 +49,10 @@ export function* cssSelectorGenerator(
4949 // if failed to find single selector matching all elements, try to find
5050 // selector for each standalone element and join them together
5151 if ( elements . length > 1 ) {
52+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53+ const { maxResults : _ignored , ...elementOptions } = custom_options ;
5254 yield elements
53- . map ( ( element ) => getCssSelector ( element , options ) )
55+ . map ( ( element ) => getCssSelector ( element , elementOptions ) )
5456 . join ( SELECTOR_SEPARATOR ) ;
5557 foundResults ++ ;
5658 if ( foundResults >= options . maxResults ) {
Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ describe("CssSelectorGenerator", function () {
2727 } ) ;
2828 } ) ;
2929
30+ describe ( "multi-element selectors" , function ( ) {
31+ it ( "should not include :scope when root and useScope are not provided" , ( ) => {
32+ root . innerHTML = `<div><span></span></div><div><span></span></div>` ;
33+ const elements = Array . from ( root . querySelectorAll ( "span" ) ) ;
34+ const result = getCssSelector ( elements ) ;
35+ assert . notInclude ( result , ":scope" ) ;
36+ } ) ;
37+ } ) ;
38+
3039 describe ( "special scenarios" , function ( ) {
3140 it ( "should not crash on parent-less element" , function ( ) {
3241 const element = document . createElement ( "div" ) ;
@@ -94,7 +103,8 @@ describe("CssSelectorGenerator", function () {
94103 } ) ;
95104
96105 it ( "should work with mixed generated and regular classes" , ( ) => {
97- root . innerHTML = '<div class="sc-xyz button-primary makeStyles-123"></div>' ;
106+ root . innerHTML =
107+ '<div class="sc-xyz button-primary makeStyles-123"></div>' ;
98108 const result = getCssSelector ( root . firstElementChild , {
99109 ignoreGeneratedClassNames : true ,
100110 } ) ;
You can’t perform that action at this time.
0 commit comments