From 1ae3e29732c37ae4e646c0d26f3ed628b94f3e0e Mon Sep 17 00:00:00 2001 From: Matt Henkes Date: Thu, 21 Oct 2021 06:14:20 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Chris Breiding --- .../cypress/integration/cypress/selector_playground_spec.js | 4 ++-- packages/driver/src/cypress/selector_playground.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/driver/cypress/integration/cypress/selector_playground_spec.js b/packages/driver/cypress/integration/cypress/selector_playground_spec.js index 7c8555b91a77..dffc390dcb89 100644 --- a/packages/driver/cypress/integration/cypress/selector_playground_spec.js +++ b/packages/driver/cypress/integration/cypress/selector_playground_spec.js @@ -40,7 +40,7 @@ describe('src/cypress/selector_playground', () => { expect(SelectorPlayground.getSelectorPriority()).to.eql(selectorPriority) }) - it('throws if selector:playground:priority if selectorPriority contains an unsupported priority', () => { + it('throws if selectorPriority contains an unsupported priority', () => { const fn = () => { SelectorPlayground.defaults({ selectorPriority: [ @@ -55,7 +55,7 @@ describe('src/cypress/selector_playground', () => { .and.include('`Cypress.SelectorPlayground.defaults()` called with invalid `selectorPriority` property. It must be one of: `data-*`, `id`, `class`, `tag`, `attributes`, `nth-child`. You passed: `name`') }) - it('throws if selector:playground:priority has an unsupported priority that contains a substring of a valid priority', () => { + it('throws if selectorPriority has an unsupported priority that contains a substring of a valid priority', () => { const fn = () => { SelectorPlayground.defaults({ selectorPriority: [ diff --git a/packages/driver/src/cypress/selector_playground.ts b/packages/driver/src/cypress/selector_playground.ts index 27df9ca12e1e..60cf9e1446e7 100644 --- a/packages/driver/src/cypress/selector_playground.ts +++ b/packages/driver/src/cypress/selector_playground.ts @@ -69,7 +69,7 @@ export default { // Validate that the priority is one of: "data-*", "id", "class", "tag", "attributes", "nth-child" selectorPriority.forEach((priority) => { - if (!priority.match(/^(data\-.*|id|class|tag|attributes|nth\-child)$/)) { + if (!/^(data\-.*|id|class|tag|attributes|nth\-child)$/.test(priority)) { $errUtils.throwErrByPath('selector_playground.defaults_invalid_priority', { args: { arg: priority }, })