diff --git a/.all-contributorsrc b/.all-contributorsrc index 5b699465..0a043692 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1605,7 +1605,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/124147726?v=4", "profile": "https://github.com/jlp-craigmorten", "contributions": [ - "code" + "code", + "question" ] }, { diff --git a/.github/ISSUE_TEMPLATE/Bug_Report.md b/.github/ISSUE_TEMPLATE/Bug_Report.md index b1205113..72faa5f4 100644 --- a/.github/ISSUE_TEMPLATE/Bug_Report.md +++ b/.github/ISSUE_TEMPLATE/Bug_Report.md @@ -54,8 +54,8 @@ minimal amount of code possible. Repository template: https://github.com/testing-library/dom-testing-library-template -Or if you can, try to reproduce the issue in a Codesandbox. You can fork the one -here: https://codesandbox.io/s/5z6x4r7n0p +Or if you can, try to reproduce the issue in StackBlitz. You can fork the one +here: https://testing-library.com/new-dtl --> ### Problem description: diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1ef5141d..e0098c08 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -29,7 +29,7 @@ jobs: # Otherwise we would not know if the problem is tied to the Node.js version fail-fast: false matrix: - node: [14, 16, 18, 20] + node: [18, 20] runs-on: ubuntu-latest steps: - name: ⬇️ Checkout repo @@ -43,10 +43,6 @@ jobs: with: node-version: ${{ matrix.node }} - # Ideally done by actions/setup-node: https://github.com/actions/setup-node/issues/213 - - name: Setup package manager - run: npm install -g npm@9.2.0 - - name: 📥 Download deps uses: bahmutov/npm-install@v1 with: @@ -85,10 +81,6 @@ jobs: with: node-version: 18 - # Ideally done by actions/setup-node: https://github.com/actions/setup-node/issues/213 - - name: Setup package manager - run: npm install -g npm@9.2.0 - - name: 📥 Download deps uses: bahmutov/npm-install@v1 with: diff --git a/README.md b/README.md index 2323bb5b..95795366 100644 --- a/README.md +++ b/README.md @@ -343,7 +343,7 @@ Thanks goes to these people ([emoji key][emojis]): Raphaël LEMIEUX
Raphaël LEMIEUX

💻 Arthur Lauck Vilas Boas
Arthur Lauck Vilas Boas

📖 Daniel Acuña
Daniel Acuña

💻 - Craig Morten
Craig Morten

💻 + Craig Morten
Craig Morten

💻 💬 Naor Peled
Naor Peled

💻 Julien Wajsberg
Julien Wajsberg

💻 🐛 Kevin BON
Kevin BON

💻 🐛 diff --git a/src/__tests__/events.js b/src/__tests__/events.js index 20d01b0d..f96c0da1 100644 --- a/src/__tests__/events.js +++ b/src/__tests__/events.js @@ -77,8 +77,8 @@ const eventTypes = [ elementType: 'img', }, { - type: '', - events: ['offline', 'online'], + type: 'Window', + events: ['offline', 'online', 'pageHide', 'pageShow'], elementType: 'window', }, { diff --git a/src/__tests__/role.js b/src/__tests__/role.js index fe31c2ea..447a6e8b 100644 --- a/src/__tests__/role.js +++ b/src/__tests__/role.js @@ -199,16 +199,16 @@ test('can be filtered by accessible name', () => { `

Order

-

Delivery Adress

-
+

Delivery Address

+
-

Invoice Adress

-
+

Invoice Address

+
`, ) - const deliveryForm = getByRole('form', {name: 'Delivery Adress'}) + const deliveryForm = getByRole('form', {name: 'Delivery Address'}) expect(deliveryForm).not.toBeNull() expect( getQueriesForElement(deliveryForm).getByRole('button', {name: 'Submit'}), ).not.toBeNull() - const invoiceForm = getByRole('form', {name: 'Delivery Adress'}) + const invoiceForm = getByRole('form', {name: 'Delivery Address'}) expect(invoiceForm).not.toBeNull() expect( diff --git a/src/__tests__/wait-for-element-to-be-removed.js b/src/__tests__/wait-for-element-to-be-removed.js index 6ea0a091..4b6732e8 100644 --- a/src/__tests__/wait-for-element-to-be-removed.js +++ b/src/__tests__/wait-for-element-to-be-removed.js @@ -80,7 +80,7 @@ test('requires an unempty array of elements to exist first (function form)', () ) }) -test('after successful removal, fullfills promise with empty value (undefined)', () => { +test('after successful removal, fulfills promise with empty value (undefined)', () => { const {getByTestId} = renderIntoDocument(`
`) diff --git a/src/event-map.js b/src/event-map.js index 30e4f9d0..08676759 100644 --- a/src/event-map.js +++ b/src/event-map.js @@ -372,6 +372,14 @@ export const eventMap = { EventType: 'Event', defaultInit: {bubbles: false, cancelable: false}, }, + pageHide: { + EventType: 'PageTransitionEvent', + defaultInit: {bubbles: true, cancelable: true}, + }, + pageShow: { + EventType: 'PageTransitionEvent', + defaultInit: {bubbles: true, cancelable: true}, + }, } export const eventAliasMap = { diff --git a/src/queries/role.ts b/src/queries/role.ts index 98b08848..e4dd395f 100644 --- a/src/queries/role.ts +++ b/src/queries/role.ts @@ -108,7 +108,7 @@ const queryAllByRole: AllByRole = ( /* istanbul ignore next */ // guard against unknown roles // All currently released ARIA versions support `aria-current` on all roles. - // Leaving this for symetry and forward compatibility + // Leaving this for symmetry and forward compatibility if ( allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-current'] === undefined diff --git a/src/screen.ts b/src/screen.ts index fbe372ff..0c2c51e9 100644 --- a/src/screen.ts +++ b/src/screen.ts @@ -1,4 +1,4 @@ -// WARNING: `lz-string` only has a default export but statically we assume named exports are allowd +// WARNING: `lz-string` only has a default export but statically we assume named exports are allowed // TODO: Statically verify we don't rely on NodeJS implicit named imports. import lzString from 'lz-string' import {type OptionsReceived} from 'pretty-format' diff --git a/types/events.d.ts b/types/events.d.ts index 57a7edd6..b524c189 100644 --- a/types/events.d.ts +++ b/types/events.d.ts @@ -88,6 +88,8 @@ export type EventType = | 'lostPointerCapture' | 'offline' | 'online' + | 'pageHide' + | 'pageShow' export type FireFunction = ( element: Document | Element | Window | Node,