Skip to content

Commit

Permalink
fix: remove overescaping (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Jul 7, 2023
1 parent 270aad2 commit f3a96ac
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 30 deletions.
6 changes: 3 additions & 3 deletions __snapshots__/SchemaUtils.test.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ exports[
exports[
'SchemaUtils Selectors selectorToPElementSelector should convert text/my text ("my text") 1'
] = `
::-p-text(my\\ text\\ \\(\\"my\\ text\\"\\))
::-p-text(my text \\(\\"my text\\"\\))
`;

exports[
'SchemaUtils Selectors selectorToPElementSelector should convert text/my text ("my text"),aria/Test my test[role="button"] 1'
] = `
::-p-text(my\\ text\\ \\(\\"my\\ text\\"\\)) >>>> ::-p-aria(Test\\ my\\ test\\[role\\=\\"button\\"\\])
::-p-text(my text \\(\\"my text\\"\\)) >>>> ::-p-aria(Test my test[role=\\"button\\"])
`;

exports[
Expand Down Expand Up @@ -49,5 +49,5 @@ exports[
exports[
'SchemaUtils Selectors selectorToPElementSelector should convert xpath///*[@id="id"] 1'
] = `
::-p-xpath(\\/\\/\\*\\[\\@id\\=\\"id\\"\\])
::-p-xpath(//*[@id=\\"id\\"])
`;
15 changes: 1 addition & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"c8": "7.12.0",
"chai": "4.3.6",
"cross-env": "7.0.3",
"cssesc": "3.0.0",
"eslint": "8.25.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "8.5.0",
Expand Down
9 changes: 1 addition & 8 deletions rollup.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const typescript = require('@rollup/plugin-typescript').default;
const { nodeResolve } = require('@rollup/plugin-node-resolve').default;
const commonjs = require('@rollup/plugin-commonjs').default;
const dts = require('rollup-plugin-dts').default;
const pkg = require('./package.json');

Expand All @@ -20,13 +19,7 @@ module.exports = [
},
],
external: Object.keys(pkg.peerDependencies),
plugins: [
typescript({ module: 'NodeNext' }),
commonjs(),
nodeResolve({
resolveOnly: ['cssesc'],
}),
],
plugins: [typescript({ module: 'NodeNext' })],
},
{
input: 'src/main.ts',
Expand Down
5 changes: 1 addition & 4 deletions src/SchemaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
WaitForExpressionStep,
} from './Schema.js';
import { AssertedEventType, StepType } from './Schema.js';
import cssesc from 'cssesc';

export function assertAllStepTypesAreHandled(s: never): never;
export function assertAllStepTypesAreHandled(s: Step): never {
Expand Down Expand Up @@ -633,9 +632,7 @@ export function selectorToPElementSelector(selector: string[] | string) {
}

function escape(input: string) {
return cssesc(input, {
isIdentifier: true,
});
return input.replace(/['"()]/g, `\\$&`);
}

const result = selector.map((s) => {
Expand Down

0 comments on commit f3a96ac

Please sign in to comment.