Skip to content

Commit fbee246

Browse files
Fix double quotation escape
1 parent 96c58fc commit fbee246

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • workspaces/ballerina/ballerina-extension/e2e-test/e2e-playwright-tests/utils/pages

workspaces/ballerina/ballerina-extension/e2e-test/e2e-playwright-tests/utils/pages/ProjectExplorer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export class ProjectExplorer {
3333
* followed by the ", " separator, so it works on old and new VS Code.
3434
*/
3535
public static treeItemSelector(label: string): string {
36-
return `div[role="treeitem"][aria-label="${label}"], div[role="treeitem"][aria-label^="${label}, "]`;
36+
// Escape backslashes and double quotes so labels that themselves
37+
// contain quotes (e.g. `RabbitMQ Event Integration - "myQueue"`) don't
38+
// produce a malformed double-quoted CSS attribute selector.
39+
const escaped = label.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
40+
return `div[role="treeitem"][aria-label="${escaped}"], div[role="treeitem"][aria-label^="${escaped}, "]`;
3741
}
3842

3943
public async init() {

0 commit comments

Comments
 (0)