diff --git a/__snapshots__/SchemaUtils.test.ts.js b/__snapshots__/SchemaUtils.test.ts.js index 00dd5c21..4a29c0da 100644 --- a/__snapshots__/SchemaUtils.test.ts.js +++ b/__snapshots__/SchemaUtils.test.ts.js @@ -51,3 +51,15 @@ exports[ ] = ` ::-p-xpath(//*[@id=\\"id\\"]) `; + +exports[ + 'SchemaUtils Selectors selectorToPElementSelector should convert pierce/#id 1' +] = ` +:scope >>> #id +`; + +exports[ + 'SchemaUtils Selectors selectorToPElementSelector should convert pierce/#inner 1' +] = ` +:scope >>> #inner +`; diff --git a/src/SchemaUtils.ts b/src/SchemaUtils.ts index d60635e2..83f97adb 100644 --- a/src/SchemaUtils.ts +++ b/src/SchemaUtils.ts @@ -648,7 +648,7 @@ export function selectorToPElementSelector(selector: string[] | string) { s.substring(SelectorType.XPath.length + 1) )})`; case SelectorType.Pierce: - return `::-p-pierce(${s.substring(SelectorType.Pierce.length + 1)})`; + return `:scope >>> ${s.substring(SelectorType.Pierce.length + 1)}`; case SelectorType.Text: return `::-p-text(${escape( s.substring(SelectorType.Text.length + 1) diff --git a/test/SchemaUtils.test.ts b/test/SchemaUtils.test.ts index 93ab73eb..40204caa 100644 --- a/test/SchemaUtils.test.ts +++ b/test/SchemaUtils.test.ts @@ -842,6 +842,21 @@ describe('SchemaUtils', () => { selector: '.cls > div #id', content: '
test', }, + { + selector: 'pierce/#id', + content: '
test', + }, + { + selector: 'pierce/#inner', + content: `
+
+ + + + `, + }, { selector: ['.cls > div #id', '.cls > div #id'], content: `