From 3589a3a9ee6b8898899aab320e7d5452c1194bea Mon Sep 17 00:00:00 2001 From: Konnor Rogers Date: Wed, 16 Aug 2023 00:18:59 -0400 Subject: [PATCH] prettier --- __tests__/deep-query-selectors.test.tsx | 6 +- __tests__/duplicateNodes.test.tsx | 10 +-- __tests__/role-not-found.test.tsx | 2 +- __tests__/screenDebug.test.tsx | 2 +- __tests__/shadowAltText.test.tsx | 20 +++--- __tests__/shadowLabelText.test.tsx | 7 +-- __tests__/shadowText.test.tsx | 4 +- __tests__/slot-aggregation.test.tsx | 14 ++--- __tests__/within.test.tsx | 4 +- package-lock.json | 22 +++++++ package.json | 1 + src/deep-query-selectors.ts | 14 +++-- src/index.ts | 2 +- src/log-shadow-dom.ts | 2 +- src/pretty-shadow-dom.ts | 30 ++++----- src/shadow-queries.ts | 66 +++++++++---------- src/shadow-screen.ts | 84 ++++++++++++------------- src/trick-dom-testing-library.ts | 2 +- src/types.ts | 24 +++---- 19 files changed, 170 insertions(+), 146 deletions(-) diff --git a/__tests__/deep-query-selectors.test.tsx b/__tests__/deep-query-selectors.test.tsx index ccfd8e4..58ec097 100644 --- a/__tests__/deep-query-selectors.test.tsx +++ b/__tests__/deep-query-selectors.test.tsx @@ -15,13 +15,13 @@ describe("deepQuerySelector()", () => { ?.shadowRoot?.querySelectorAll("button")[1]; expect(deepQuerySelector(container, "button")).toBeInstanceOf( - HTMLButtonElement + HTMLButtonElement, ); expect(deepQuerySelector(container, "button")).toBe(btn); expect(deepQuerySelector(container, "button")).not.toBe(secondButton); expect(deepQuerySelector(baseElement, "button")).toBeInstanceOf( - HTMLButtonElement + HTMLButtonElement, ); expect(deepQuerySelector(baseElement, "button")).toBe(btn); expect(deepQuerySelector(baseElement, "button")).not.toBe(secondButton); @@ -58,7 +58,7 @@ describe("deepQuerySelectorAll()", () => { btns = deepQuerySelectorAll( document.querySelector("duplicate-buttons") as HTMLElement, - "button" + "button", ); expect(btns).toHaveLength(2); btns.forEach((btn) => expect(btn).toBeInstanceOf(HTMLButtonElement)); diff --git a/__tests__/duplicateNodes.test.tsx b/__tests__/duplicateNodes.test.tsx index 2d2ee83..2b2b11b 100644 --- a/__tests__/duplicateNodes.test.tsx +++ b/__tests__/duplicateNodes.test.tsx @@ -19,12 +19,12 @@ test("Should error if two similiar nodes actually exist", async () => { <>

Hello

Hello

- + , ); expect(() => screen.getByShadowText("Hello")).toThrow(/multiple elements/i); await expect(() => screen.findByShadowText("Hello")).rejects.toThrow( - /multiple elements/i + /multiple elements/i, ); }); @@ -32,7 +32,7 @@ test("Should error if two similar nodes are in shadow root", async () => { render(); expect(() => screen.getByShadowRole("button")).toThrow(/multiple elements/i); await expect(() => screen.findByShadowRole("button")).rejects.toThrow( - /multiple elements/i + /multiple elements/i, ); }); @@ -41,7 +41,7 @@ test("Should find duplicate nodes in a double nested shadow root", async () => { expect(() => screen.getByShadowRole("button")).toThrow(/multiple elements/i); await expect(() => screen.findByShadowRole("button")).rejects.toThrow( - /multiple elements/i + /multiple elements/i, ); }); @@ -50,6 +50,6 @@ test("Should find duplicate nodes in a triple nested shadow root", async () => { expect(() => screen.getByShadowRole("button")).toThrow(/multiple elements/i); await expect(() => screen.findByShadowRole("button")).rejects.toThrow( - /multiple elements/i + /multiple elements/i, ); }); diff --git a/__tests__/role-not-found.test.tsx b/__tests__/role-not-found.test.tsx index 8fdd8e0..74b01f2 100644 --- a/__tests__/role-not-found.test.tsx +++ b/__tests__/role-not-found.test.tsx @@ -11,7 +11,7 @@ test.skip("Should serialize custom elements properly", () => { render( - + , ); // const btn = screen.getByShadowRole("button", { name: "Not found" }) const btn = screen.getByRole("button"); diff --git a/__tests__/screenDebug.test.tsx b/__tests__/screenDebug.test.tsx index f2b97bf..0edf9ca 100644 --- a/__tests__/screenDebug.test.tsx +++ b/__tests__/screenDebug.test.tsx @@ -30,7 +30,7 @@ test("Single shadow root", async () => {
Start Slot
Default Slot
End Slot
-
+ , ); screen.debug(); diff --git a/__tests__/shadowAltText.test.tsx b/__tests__/shadowAltText.test.tsx index 2c10146..5e3d8f3 100644 --- a/__tests__/shadowAltText.test.tsx +++ b/__tests__/shadowAltText.test.tsx @@ -12,31 +12,31 @@ describe("ShadowAltText()", () => { }); expect(findContainerAlt).toBeInTheDocument(); const findContainerAlts = await screen.findAllByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(findContainerAlts.length).toBeGreaterThan(0); const queryContainerAlt = screen.queryByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(queryContainerAlt).toBeInTheDocument(); const queryContainerAlts = screen.queryAllByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(queryContainerAlts.length).toBeGreaterThan(0); const getContainerAlt = screen.getByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(getContainerAlt).toBeInTheDocument(); const getContainerAlts = screen.getAllByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(getContainerAlts.length).toBeGreaterThan(0); // // Use await findByX to let things render then use other calls. const findAlt = await screen.findByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(findAlt).toBeInTheDocument(); const findAlts = await screen.findAllByShadowAltText(/shoes/, { @@ -45,20 +45,20 @@ describe("ShadowAltText()", () => { expect(findAlts.length).toBeGreaterThan(0); const queryAlt = screen.queryByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(queryAlt).toBeInTheDocument(); const queryAlts = screen.queryAllByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(queryAlts.length).toBeGreaterThan(0); const getAlt = screen.getByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(getAlt).toBeInTheDocument(); const getAlts = screen.getAllByShadowAltText( - "Animation of untied shoes walking on pavement" + "Animation of untied shoes walking on pavement", ); expect(getAlts.length).toBeGreaterThan(0); }); diff --git a/__tests__/shadowLabelText.test.tsx b/__tests__/shadowLabelText.test.tsx index 0408cd0..207819e 100644 --- a/__tests__/shadowLabelText.test.tsx +++ b/__tests__/shadowLabelText.test.tsx @@ -11,12 +11,11 @@ describe("ByShadowLabelText()", () => { const findContainerLabel = await findByShadowLabelText( container, /omments/, - { exact: false } + { exact: false }, ); expect(findContainerLabel).toBeInTheDocument(); - const findContainerLabels = await screen.findAllByShadowLabelText( - "Comments" - ); + const findContainerLabels = + await screen.findAllByShadowLabelText("Comments"); expect(findContainerLabels.length).toBeGreaterThan(0); const queryContainerLabel = screen.queryByShadowLabelText("Comments"); diff --git a/__tests__/shadowText.test.tsx b/__tests__/shadowText.test.tsx index 8af1510..9719cc7 100644 --- a/__tests__/shadowText.test.tsx +++ b/__tests__/shadowText.test.tsx @@ -30,7 +30,7 @@ describe("ShadowText()", () => { }); const el = (await fixture( - html`` + html``, )) as HTMLElement; await nextFrame(); @@ -50,7 +50,7 @@ describe("ShadowText()", () => { it("should not suggest light dom queries", async () => { const el = (await fixture( - html`` + html``, )) as HTMLElement; await nextFrame(); diff --git a/__tests__/slot-aggregation.test.tsx b/__tests__/slot-aggregation.test.tsx index bdb8853..88e96a6 100644 --- a/__tests__/slot-aggregation.test.tsx +++ b/__tests__/slot-aggregation.test.tsx @@ -10,11 +10,11 @@ test("Should aggregate content from slots", async () => { Start button Middle Link - + , ); const startSlot = el.container.firstElementChild?.shadowRoot?.querySelector( - "slot[name='start']" + "slot[name='start']", ) as HTMLSlotElement; const btn = await within(startSlot).findAllByShadowRole("button"); expect(btn.length).toEqual(1); @@ -25,14 +25,14 @@ test("Should aggregate content from slots", async () => { expect(within(startSlot).queryByShadowRole("link")).toBeNull; const defaultSlot = el.container.firstElementChild?.shadowRoot?.querySelector( - "slot:not([name])" + "slot:not([name])", ) as HTMLSlotElement; const anchor = await within(defaultSlot).findByShadowRole("link"); expect(anchor).toBeInTheDocument(); // Make sure default slot doesnt pick up start / end slot expect( - within(defaultSlot).queryByShadowRole("button") + within(defaultSlot).queryByShadowRole("button"), ).not.toBeInTheDocument(); expect(within(defaultSlot).queryByShadowRole("img")).not.toBeInTheDocument(); @@ -44,11 +44,11 @@ test("slot aggregation should use slotted content instead of default content", ( const el = render( + , ); const labelSlot = el.container.firstElementChild?.shadowRoot?.querySelector( - "slot[name='label']" + "slot[name='label']", ) as HTMLSlotElement; expect(within(labelSlot).queryByText("My Label")).toBeTruthy; @@ -58,7 +58,7 @@ test("slot aggregation should use default items when not given slotted content", const el = render(); const labelSlot = el.container.firstElementChild?.shadowRoot?.querySelector( - "slot[name='label']" + "slot[name='label']", ) as HTMLSlotElement; expect(within(labelSlot).queryByText("My Label")).toBeTruthy; diff --git a/__tests__/within.test.tsx b/__tests__/within.test.tsx index d007dcd..bbdb61a 100644 --- a/__tests__/within.test.tsx +++ b/__tests__/within.test.tsx @@ -12,7 +12,7 @@ describe("within", () => { + , ); const shadowSelect = await screen.findByShadowRole("combobox"); @@ -30,7 +30,7 @@ describe("within", () => { it("Should find the nested button", async () => { render(); const btns = await within( - document.querySelector("duplicate-buttons") as HTMLElement + document.querySelector("duplicate-buttons") as HTMLElement, ).findAllByShadowRole("button"); expect(btns).toHaveLength(2); btns.forEach((btn) => expect(btn).toBeInstanceOf(HTMLButtonElement)); diff --git a/package-lock.json b/package-lock.json index 4c76a56..ec4369c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "jest-environment-jsdom": "^28.1.2", "jest-preview": "^0.2.6", "jsdom": "^20.0.2", + "prettier": "^3.0.2", "react": "^18.2.0", "react-dom": "^18.2.0", "standard-version": "^9.5.0", @@ -7564,6 +7565,21 @@ "node": ">=4" } }, + "node_modules/prettier": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", + "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", @@ -15436,6 +15452,12 @@ "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==", "dev": true }, + "prettier": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", + "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", + "dev": true + }, "pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", diff --git a/package.json b/package.json index 77786e6..e286d21 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "jest-environment-jsdom": "^28.1.2", "jest-preview": "^0.2.6", "jsdom": "^20.0.2", + "prettier": "^3.0.2", "react": "^18.2.0", "react-dom": "^18.2.0", "standard-version": "^9.5.0", diff --git a/src/deep-query-selectors.ts b/src/deep-query-selectors.ts index 6100037..e09ac34 100644 --- a/src/deep-query-selectors.ts +++ b/src/deep-query-selectors.ts @@ -5,7 +5,7 @@ import { Container, ShadowOptions } from "./types"; export function deepQuerySelector( container: Container, selector: string, - options: ShadowOptions = { shallow: false, maxDepth: Infinity } + options: ShadowOptions = { shallow: false, maxDepth: Infinity }, ): T | null { const els = deepQuerySelectorAll(container, selector, options); @@ -31,7 +31,7 @@ export function deepQuerySelector( export function deepQuerySelectorAll( container: Container, selector: string, - options: ShadowOptions = { shallow: false, maxDepth: Infinity } + options: ShadowOptions = { shallow: false, maxDepth: Infinity }, ): T[] { return patchWrap(() => { const elements = getAllElementsAndShadowRoots(container, options); @@ -47,12 +47,14 @@ export function deepQuerySelectorAll( // maybe an infinite generator in the future? export function getAllElementsAndShadowRoots( container: Container, - options: ShadowOptions = { shallow: false, maxDepth: Infinity } + options: ShadowOptions = { shallow: false, maxDepth: Infinity }, ) { if (options.shallow === true) { - console.warn("The 'shallow' option will go away in v2.0.0 of SDTL. The replacement will be 'maxDepth: 1'") - options.maxDepth = 1 + console.warn( + "The 'shallow' option will go away in v2.0.0 of SDTL. The replacement will be 'maxDepth: 1'", + ); + options.maxDepth = 1; } - return findAllElements(container, options.maxDepth) + return findAllElements(container, options.maxDepth); } diff --git a/src/index.ts b/src/index.ts index 09717f2..df90dd8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,7 @@ configure({ }\n${prettifiedDOM}`, ] .filter(Boolean) - .join("\n\n") + .join("\n\n"), ); error.name = "ShadowDOMTestingLibraryElementError"; return error; diff --git a/src/log-shadow-dom.ts b/src/log-shadow-dom.ts index acc71eb..83735ab 100644 --- a/src/log-shadow-dom.ts +++ b/src/log-shadow-dom.ts @@ -12,7 +12,7 @@ export function logShadowDOM( let [dom, maxLength, options] = args; const plugin: NewPlugin = createDOMElementFilter( - options?.filterNode || filterCommentsAndDefaultIgnoreTagsTags + options?.filterNode || filterCommentsAndDefaultIgnoreTagsTags, ); if (options == null) options = {}; diff --git a/src/pretty-shadow-dom.ts b/src/pretty-shadow-dom.ts index 0b26909..023a9bf 100644 --- a/src/pretty-shadow-dom.ts +++ b/src/pretty-shadow-dom.ts @@ -8,7 +8,7 @@ const findWhiteSpace = /([^\S\r\n]*[\f\n\r\t\v]+)/.source; function removeDuplicateNewLines(str: string) { let final = str.replace( new RegExp(`${findWhiteSpace}.*${findWhiteSpace}{2,}`, "g"), - "" + "", ); return final; } @@ -19,7 +19,7 @@ export function prettyShadowDOM( let [dom, maxLength, options] = args; const plugin: NewPlugin = createDOMElementFilter( - options?.filterNode || filterCommentsAndDefaultIgnoreTagsTags + options?.filterNode || filterCommentsAndDefaultIgnoreTagsTags, ); if (options == null) options = {}; @@ -31,7 +31,7 @@ export function prettyShadowDOM( prettyDOM(dom, maxLength, { ...options, plugins: [plugin], - }) + }), ); } @@ -56,7 +56,7 @@ const printProps = ( indentation: string, depth: number, refs: Refs, - printer: Printer + printer: Printer, ): string => { const indentationNext = indentation + config.indent; const colors = config.colors; @@ -103,7 +103,7 @@ const printChildren = ( indentation: string, depth: number, refs: Refs, - printer: Printer + printer: Printer, ): string => removeDuplicateNewLines( children @@ -124,7 +124,7 @@ const printChildren = ( } return config.spacingOuter + indentation + printedChild; }) - .join("") + .join(""), ); const printText = (text: string, config: Config): string => { @@ -152,7 +152,7 @@ const printElement = ( printedProps: string, printedChildren: string, config: Config, - indentation: string + indentation: string, ): string => { const tagColor = config.colors.tag; @@ -234,16 +234,16 @@ function nodeIsComment(node: HandledType): node is Comment { } function nodeIsFragment( - node: HandledType + node: HandledType, ): node is DocumentFragment | ShadowRoot { return node.nodeType === FRAGMENT_NODE; } export function createDOMElementFilter( - filterNode: (node: Node) => boolean + filterNode: (node: Node) => boolean, ): NewPlugin { function getChildren( - node: Element | DocumentFragment | ShadowRoot + node: Element | DocumentFragment | ShadowRoot, ): (Node | Element | ShadowRoot)[] { const children: (Node | Element | ShadowRoot)[] = Array.prototype.slice.call(node.childNodes || node.children); @@ -267,7 +267,7 @@ export function createDOMElementFilter( indentation: string, depth: number, refs: Refs, - printer: Printer + printer: Printer, ) => { if (nodeIsText(node)) { return printText(node.data, config); @@ -304,13 +304,13 @@ export function createDOMElementFilter( props[attribute.name] = attribute.value; return props; }, - {} + {}, ), config, indentation + config.indent, depth, refs, - printer + printer, ), printChildren( getChildren(node) as unknown[], @@ -318,10 +318,10 @@ export function createDOMElementFilter( indentation + config.indent, depth, refs, - printer + printer, ), config, - indentation + indentation, ); }, }; diff --git a/src/shadow-queries.ts b/src/shadow-queries.ts index 2f2190b..d1718ed 100644 --- a/src/shadow-queries.ts +++ b/src/shadow-queries.ts @@ -51,8 +51,8 @@ function queryAllByShadowRole( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByRole(el as HTMLElement, role, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -72,8 +72,8 @@ const [ buildQueries( queryAllByShadowRole, getMultipleRoleError, - getMissingRoleError - ) + getMissingRoleError, + ), ); // Label Text @@ -93,8 +93,8 @@ function queryAllByShadowLabelText( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByLabelText(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -114,8 +114,8 @@ const [ buildQueries( queryAllByShadowLabelText, getMultipleLabelTextError, - getMissingLabelTextError - ) + getMissingLabelTextError, + ), ); // Placeholder Text @@ -135,10 +135,10 @@ function queryAllByShadowPlaceholderText( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => - queryAllByPlaceholderText(el as HTMLElement, id, options) + queryAllByPlaceholderText(el as HTMLElement, id, options), ) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -158,8 +158,8 @@ const [ buildQueries( queryAllByShadowPlaceholderText, getMultiplePlaceholderTextError, - getMissingPlaceholderTextError - ) + getMissingPlaceholderTextError, + ), ); // Text @@ -179,8 +179,8 @@ function queryAllByShadowText( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByText(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -200,8 +200,8 @@ const [ buildQueries( queryAllByShadowText, getMultipleTextError, - getMissingTextError - ) + getMissingTextError, + ), ); // Display Value @@ -221,8 +221,8 @@ function queryAllByShadowDisplayValue( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByDisplayValue(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -242,8 +242,8 @@ const [ buildQueries( queryAllByShadowDisplayValue, getMultipleDisplayValueError, - getMissingDisplayValueError - ) + getMissingDisplayValueError, + ), ); // Alt Text @@ -263,8 +263,8 @@ function queryAllByShadowAltText( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByAltText(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -284,8 +284,8 @@ const [ buildQueries( queryAllByShadowAltText, getMultipleAltTextError, - getMissingAltTextError - ) + getMissingAltTextError, + ), ); // Title @@ -305,8 +305,8 @@ function queryAllByShadowTitle( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByTitle(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -326,8 +326,8 @@ const [ buildQueries( queryAllByShadowTitle, getMultipleTitleError, - getMissingTitleError - ) + getMissingTitleError, + ), ); // Test Id @@ -347,8 +347,8 @@ function queryAllByShadowTestId( patchWrap(() => getAllElementsAndShadowRoots(container, options) .map((el) => queryAllByTestId(el as HTMLElement, id, options)) - .flat(Infinity) - ) + .flat(Infinity), + ), ), ] as T[]; } @@ -368,8 +368,8 @@ const [ buildQueries( queryAllByShadowTestId, getMultipleTestIdError, - getMissingTestIdError - ) + getMissingTestIdError, + ), ); export { diff --git a/src/shadow-screen.ts b/src/shadow-screen.ts index d4a6010..c589569 100644 --- a/src/shadow-screen.ts +++ b/src/shadow-screen.ts @@ -20,7 +20,7 @@ const shadowScreen = { shadowQueries.queryAllByShadowRole( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowRole: (...args: ScreenShadowRoleMatcherParams) => shadowQueries.queryByShadowRole(document.documentElement, args[0], args[1]), @@ -28,7 +28,7 @@ const shadowScreen = { shadowQueries.getAllByShadowRole( document.documentElement, args[0], - args[1] + args[1], ), getByShadowRole: (...args: ScreenShadowRoleMatcherParams) => shadowQueries.getByShadowRole(document.documentElement, args[0], args[1]), @@ -37,14 +37,14 @@ const shadowScreen = { document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowRole: (...args: AsyncScreenShadowRoleMatcherParams) => shadowQueries.findByShadowRole( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Label Text @@ -52,39 +52,39 @@ const shadowScreen = { shadowQueries.queryAllByShadowLabelText( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowLabelText: (...args: ScreenShadowSelectorMatcherParams) => shadowQueries.queryByShadowLabelText( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowLabelText: (...args: ScreenShadowSelectorMatcherParams) => shadowQueries.getAllByShadowLabelText( document.documentElement, args[0], - args[1] + args[1], ), getByShadowLabelText: (...args: ScreenShadowSelectorMatcherParams) => shadowQueries.getByShadowLabelText( document.documentElement, args[0], - args[1] + args[1], ), findAllByShadowLabelText: (...args: AsyncScreenShadowSelectorMatcherParams) => shadowQueries.findAllByShadowLabelText( document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowLabelText: (...args: AsyncScreenShadowSelectorMatcherParams) => shadowQueries.findByShadowLabelText( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Placeholder Text @@ -92,39 +92,39 @@ const shadowScreen = { shadowQueries.queryAllByShadowPlaceholderText( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowPlaceholderText: (...args: ScreenShadowMatcherParams) => shadowQueries.queryByShadowPlaceholderText( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowPlaceholderText: (...args: ScreenShadowMatcherParams) => shadowQueries.getAllByShadowPlaceholderText( document.documentElement, args[0], - args[1] + args[1], ), getByShadowPlaceholderText: (...args: ScreenShadowMatcherParams) => shadowQueries.getByShadowPlaceholderText( document.documentElement, args[0], - args[1] + args[1], ), findAllByShadowPlaceholderText: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findAllByShadowPlaceholderText( document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowPlaceholderText: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findByShadowPlaceholderText( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Text @@ -132,7 +132,7 @@ const shadowScreen = { shadowQueries.queryAllByShadowText( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowText: (...args: ScreenShadowSelectorMatcherParams) => shadowQueries.queryByShadowText(document.documentElement, args[0], args[1]), @@ -140,7 +140,7 @@ const shadowScreen = { shadowQueries.getAllByShadowText( document.documentElement, args[0], - args[1] + args[1], ), getByShadowText: (...args: ScreenShadowSelectorMatcherParams) => shadowQueries.getByShadowText(document.documentElement, args[0], args[1]), @@ -149,14 +149,14 @@ const shadowScreen = { document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowText: (...args: AsyncScreenShadowSelectorMatcherParams) => shadowQueries.findByShadowText( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Display Value @@ -164,39 +164,39 @@ const shadowScreen = { shadowQueries.queryAllByShadowDisplayValue( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowDisplayValue: (...args: ScreenShadowMatcherParams) => shadowQueries.queryByShadowDisplayValue( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowDisplayValue: (...args: ScreenShadowMatcherParams) => shadowQueries.getAllByShadowDisplayValue( document.documentElement, args[0], - args[1] + args[1], ), getByShadowDisplayValue: (...args: ScreenShadowMatcherParams) => shadowQueries.getByShadowDisplayValue( document.documentElement, args[0], - args[1] + args[1], ), findAllByShadowDisplayValue: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findAllByShadowDisplayValue( document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowDisplayValue: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findByShadowDisplayValue( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Alt Text @@ -204,39 +204,39 @@ const shadowScreen = { shadowQueries.queryAllByShadowAltText( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowAltText: (...args: ScreenShadowMatcherParams) => shadowQueries.queryByShadowAltText( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowAltText: (...args: ScreenShadowMatcherParams) => shadowQueries.getAllByShadowAltText( document.documentElement, args[0], - args[1] + args[1], ), getByShadowAltText: (...args: ScreenShadowMatcherParams) => shadowQueries.getByShadowAltText( document.documentElement, args[0], - args[1] + args[1], ), findAllByShadowAltText: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findAllByShadowAltText( document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowAltText: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findByShadowAltText( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Title @@ -244,19 +244,19 @@ const shadowScreen = { shadowQueries.queryAllByShadowTitle( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowTitle: (...args: ScreenShadowMatcherParams) => shadowQueries.queryByShadowTitle( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowTitle: (...args: ScreenShadowMatcherParams) => shadowQueries.getAllByShadowTitle( document.documentElement, args[0], - args[1] + args[1], ), getByShadowTitle: (...args: ScreenShadowMatcherParams) => shadowQueries.getByShadowTitle(document.documentElement, args[0], args[1]), @@ -265,14 +265,14 @@ const shadowScreen = { document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowTitle: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findByShadowTitle( document.documentElement, args[0], args[1], - args[2] + args[2], ), // Test Id @@ -280,19 +280,19 @@ const shadowScreen = { shadowQueries.queryAllByShadowTestId( document.documentElement, args[0], - args[1] + args[1], ), queryByShadowTestId: (...args: ScreenShadowMatcherParams) => shadowQueries.queryByShadowTestId( document.documentElement, args[0], - args[1] + args[1], ), getAllByShadowTestId: (...args: ScreenShadowMatcherParams) => shadowQueries.getAllByShadowTestId( document.documentElement, args[0], - args[1] + args[1], ), getByShadowTestId: (...args: ScreenShadowMatcherParams) => shadowQueries.getByShadowTestId(document.documentElement, args[0], args[1]), @@ -301,14 +301,14 @@ const shadowScreen = { document.documentElement, args[0], args[1], - args[2] + args[2], ), findByShadowTestId: (...args: AsyncScreenShadowMatcherParams) => shadowQueries.findByShadowTestId( document.documentElement, args[0], args[1], - args[2] + args[2], ), }; diff --git a/src/trick-dom-testing-library.ts b/src/trick-dom-testing-library.ts index f40de68..5c91e57 100644 --- a/src/trick-dom-testing-library.ts +++ b/src/trick-dom-testing-library.ts @@ -27,7 +27,7 @@ function removeDOMPatch() { } export function patchWrap any>( - callback: T + callback: T, ): ReturnType { patchDOM(); diff --git a/src/types.ts b/src/types.ts index a53643f..a696248 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,56 +23,56 @@ export interface ShadowSelectorMatcherOptions // For queryBy / getBy queries export type ShadowRoleMatcherParams = [ container: HTMLElement, - ...args: ScreenShadowRoleMatcherParams + ...args: ScreenShadowRoleMatcherParams, ]; export type ShadowSelectorMatcherParams = [ container: HTMLElement, - ...args: ScreenShadowSelectorMatcherParams + ...args: ScreenShadowSelectorMatcherParams, ]; export type ShadowMatcherParams = [ container: HTMLElement, - ...args: ScreenShadowMatcherParams + ...args: ScreenShadowMatcherParams, ]; export type ScreenShadowRoleMatcherParams = [ role: ByRoleMatcher, - options?: ShadowByRoleOptions | undefined + options?: ShadowByRoleOptions | undefined, ]; export type ScreenShadowSelectorMatcherParams = [ id: Matcher, - options?: ShadowSelectorMatcherOptions | undefined + options?: ShadowSelectorMatcherOptions | undefined, ]; export type ScreenShadowMatcherParams = [ id: Matcher, - options?: ShadowMatcherOptions | undefined + options?: ShadowMatcherOptions | undefined, ]; // For findBy queries export type AsyncShadowRoleMatcherParams = [ container: HTMLElement, - ...args: AsyncScreenShadowRoleMatcherParams + ...args: AsyncScreenShadowRoleMatcherParams, ]; export type AsyncShadowSelectorMatcherParams = [ container: HTMLElement, - ...args: AsyncScreenShadowSelectorMatcherParams + ...args: AsyncScreenShadowSelectorMatcherParams, ]; export type AsyncShadowMatcherParams = [ container: HTMLElement, - ...args: AsyncScreenShadowMatcherParams + ...args: AsyncScreenShadowMatcherParams, ]; export type AsyncScreenShadowRoleMatcherParams = [ role: ByRoleMatcher, options?: ShadowByRoleOptions | undefined, - waitForOptions?: waitForOptions | undefined + waitForOptions?: waitForOptions | undefined, ]; export type AsyncScreenShadowSelectorMatcherParams = [ id: Matcher, options?: ShadowSelectorMatcherOptions | undefined, - waitForOptions?: waitForOptions | undefined + waitForOptions?: waitForOptions | undefined, ]; export type AsyncScreenShadowMatcherParams = [ id: Matcher, options?: ShadowMatcherOptions | undefined, - waitForOptions?: waitForOptions | undefined + waitForOptions?: waitForOptions | undefined, ];