-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support legacy TS configurations (#5)
* fix: support legacy TS setups * chore: version bump * docs: update with new examples
- Loading branch information
1 parent
5f3dbda
commit c450586
Showing
31 changed files
with
3,408 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# TypeScript Legacy Example | ||
|
||
A basic example where Virtual Screen Reader Jest Matchers is used for a legacy TypeScript CommonJS application. | ||
|
||
Run this example with: | ||
|
||
```bash | ||
# Install and build core package | ||
yarn install --frozen-lockfile | ||
|
||
# Navigate to example, install, and test | ||
cd examples/typescript-legacy | ||
yarn install --frozen-lockfile | ||
yarn test | ||
``` | ||
|
||
> [!IMPORTANT] | ||
> This example serves to demonstrate how you can use the Virtual Screen Reader Jest Matchers. The components themselves may not be using best accessibility practices. | ||
> | ||
> Always evaluate your own components for accessibility and test with real users. |
1 change: 1 addition & 0 deletions
1
examples/typescript/jest.config.js → examples/typescript-legacy/jest.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import "../../lib/cjs/index.js"; | ||
// In your code, replace with: | ||
// import "@guidepup/jest"; | ||
|
||
jest.setTimeout(10000); |
12 changes: 6 additions & 6 deletions
12
examples/typescript/package.json → examples/typescript-legacy/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"name": "@guidepup/jest-typescript-example", | ||
"name": "@guidepup/jest-typescript-legacy-example", | ||
"version": "1.0.0", | ||
"description": "Virtual Screen Reader Jest Matchers TypeScript Example", | ||
"author": "Craig Morten <craig.morten@hotmail.co.uk>", | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"test": "jest", | ||
"test:coverage": "yarn test --coverage" | ||
"preinstall": "yarn --cwd=../.. build", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@guidepup/jest": "file:../../", | ||
"@guidepup/virtual-screen-reader": "^0.25.0", | ||
"@guidepup/virtual-screen-reader": "^0.26.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.14.8", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"ts-jest": "^29.1.5", | ||
"ts-jest-resolver": "^2.0.1", | ||
"typescript": "^5.5.2" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"module": "CommonJS", | ||
"moduleResolution": "Node", | ||
"esModuleInterop": true, | ||
"strict": true | ||
}, | ||
"include": ["src/**/*", "jest.setup.ts"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
preset: "ts-jest", | ||
resolver: "ts-jest-resolver", | ||
testEnvironment: "jsdom", | ||
roots: ["src"], | ||
collectCoverageFrom: ["**/*.ts"], | ||
coveragePathIgnorePatterns: [], | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import "../../lib/cjs/index.js"; | ||
// In your code, replace with: | ||
// import "@guidepup/jest"; | ||
|
||
jest.setTimeout(10000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@guidepup/jest-typescript-nodenext-example", | ||
"version": "1.0.0", | ||
"author": "Craig Morten <craig.morten@hotmail.co.uk>", | ||
"license": "MIT", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"preinstall": "yarn --cwd=../.. build", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@guidepup/virtual-screen-reader": "^0.26.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.14.8", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"ts-jest": "^29.1.5", | ||
"ts-jest-resolver": "^2.0.1", | ||
"typescript": "^5.5.2" | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
examples/typescript-nodenext/src/__snapshots__/matchers.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`matchers snapshot matchers handles parallel assertions: toMatchScreenReaderSnapshot 1`] = ` | ||
[ | ||
"region", | ||
"heading, Second Section Heading, level 1", | ||
"paragraph", | ||
"Second Section Text", | ||
"end of paragraph", | ||
"end of region", | ||
] | ||
`; | ||
|
||
exports[`matchers toMatchScreenReaderSnapshot on a hidden node: toMatchScreenReaderSnapshot 1`] = `[]`; | ||
|
||
exports[`matchers toMatchScreenReaderSnapshot on a null node: toMatchScreenReaderSnapshot 1`] = `[]`; | ||
|
||
exports[`matchers toMatchScreenReaderSnapshot on a text node: toMatchScreenReaderSnapshot 1`] = ` | ||
[ | ||
"Nav Text", | ||
] | ||
`; | ||
|
||
exports[`matchers toMatchScreenReaderSnapshot on an element: toMatchScreenReaderSnapshot 1`] = ` | ||
[ | ||
"region", | ||
"heading, Second Section Heading, level 1", | ||
"paragraph", | ||
"Second Section Text", | ||
"end of paragraph", | ||
"end of region", | ||
] | ||
`; | ||
|
||
exports[`matchers toMatchScreenReaderSnapshot on the whole body: toMatchScreenReaderSnapshot 1`] = ` | ||
[ | ||
"document", | ||
"navigation", | ||
"Nav Text", | ||
"end of navigation", | ||
"region", | ||
"heading, First Section Heading, level 1", | ||
"paragraph", | ||
"First Section Text", | ||
"end of paragraph", | ||
"article", | ||
"banner", | ||
"heading, Article Header Heading, level 1", | ||
"paragraph", | ||
"Article Header Text", | ||
"end of paragraph", | ||
"end of banner", | ||
"paragraph", | ||
"Article Text", | ||
"end of paragraph", | ||
"end of article", | ||
"end of region", | ||
"region", | ||
"heading, Second Section Heading, level 1", | ||
"paragraph", | ||
"Second Section Text", | ||
"end of paragraph", | ||
"end of region", | ||
"contentinfo", | ||
"Footer", | ||
"end of contentinfo", | ||
"end of document", | ||
] | ||
`; |
47 changes: 47 additions & 0 deletions
47
examples/typescript-nodenext/src/__snapshots__/mix.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`matchers snapshot tests toMatchScreenReaderSnapshot on the whole body: toMatchScreenReaderSnapshot 1`] = ` | ||
[ | ||
"document", | ||
"navigation", | ||
"Nav Text", | ||
"end of navigation", | ||
"region", | ||
"heading, First Section Heading, level 1", | ||
"paragraph", | ||
"First Section Text", | ||
"end of paragraph", | ||
"article", | ||
"banner", | ||
"heading, Article Header Heading, level 1", | ||
"paragraph", | ||
"Article Header Text", | ||
"end of paragraph", | ||
"end of banner", | ||
"paragraph", | ||
"Article Text", | ||
"end of paragraph", | ||
"end of article", | ||
"end of region", | ||
"region", | ||
"heading, Second Section Heading, level 1", | ||
"paragraph", | ||
"Second Section Text", | ||
"end of paragraph", | ||
"end of region", | ||
"contentinfo", | ||
"Footer", | ||
"end of contentinfo", | ||
"end of document", | ||
] | ||
`; | ||
|
||
exports[`matchers virtual screen reader tests navigating headings 1`] = ` | ||
[ | ||
"document", | ||
"heading, First Section Heading, level 1", | ||
"heading, Article Header Heading, level 1", | ||
"heading, Second Section Heading, level 1", | ||
"heading, First Section Heading, level 1", | ||
] | ||
`; |
Oops, something went wrong.