From 2855f612beb5ed1ac13022fb7116b3c01c6d23bc Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 21 Oct 2024 15:23:04 +0200 Subject: [PATCH] refactor: remove useless constant --- .../src/utils/isomorphic/locatorGenerators.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts b/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts index 56252d02d3..7cb658340c 100644 --- a/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts +++ b/packages/playwright-core/src/utils/isomorphic/locatorGenerators.ts @@ -163,14 +163,12 @@ function innerAsLocators(factory: LocatorFactory, parsed: ParsedSelector, isFram continue; } - let locatorType: LocatorType = 'default'; - const nextPart = parts[index + 1]; const selectorPart = stringifySelector({ parts: [part] }); - const locatorPart = factory.generateLocator(base, locatorType, selectorPart); + const locatorPart = factory.generateLocator(base, 'default', selectorPart); - if (locatorType === 'default' && nextPart && ['internal:has-text', 'internal:has-not-text'].includes(nextPart.name)) { + if (nextPart && ['internal:has-text', 'internal:has-not-text'].includes(nextPart.name)) { const { exact, text } = detectExact(nextPart.body as string); // There is no locator equivalent for strict has-text and has-not-text, leave it as is. if (!exact) { @@ -194,7 +192,7 @@ function innerAsLocators(factory: LocatorFactory, parsed: ParsedSelector, isFram let locatorPartWithEngine: string | undefined; if (['xpath', 'css'].includes(part.name)) { const selectorPart = stringifySelector({ parts: [part] }, /* forceEngineName */ true); - locatorPartWithEngine = factory.generateLocator(base, locatorType, selectorPart); + locatorPartWithEngine = factory.generateLocator(base, 'default', selectorPart); } tokens.push([locatorPart, locatorPartWithEngine].filter(Boolean) as string[]);