Skip to content

Commit 63539e5

Browse files
chore: remove dependency on @guidepup/guidepup package
1 parent a5e56a5 commit 63539e5

File tree

6 files changed

+663
-859
lines changed

6 files changed

+663
-859
lines changed

package.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@guidepup/virtual-screen-reader",
3-
"version": "0.27.1",
3+
"version": "0.28.0",
44
"description": "Virtual Screen Reader driver for unit test automation.",
55
"author": "Craig Morten <[email protected]>",
66
"license": "MIT",
@@ -32,10 +32,6 @@
3232
"require": {
3333
"types": "./lib/cjs/index.d.ts",
3434
"default": "./lib/cjs/index.cjs"
35-
},
36-
"default": {
37-
"types": "./lib/cjs/index.d.ts",
38-
"default": "./lib/cjs/index.cjs"
3935
}
4036
},
4137
"./browser.js": {
@@ -64,21 +60,20 @@
6460
"wpt:update": "yarn wpt:init --remote && cd test/wpt && python wpt.py manifest --path ../wpt-jsdom/wpt-manifest.json"
6561
},
6662
"dependencies": {
67-
"@guidepup/guidepup": "^0.22.3",
6863
"@testing-library/dom": "^10.4.0",
6964
"@testing-library/user-event": "^14.5.2",
7065
"aria-query": "^5.3.0",
71-
"dom-accessibility-api": "^0.6.3"
66+
"dom-accessibility-api": "^0.7.0"
7267
},
7368
"devDependencies": {
74-
"@arethetypeswrong/cli": "^0.15.3",
69+
"@arethetypeswrong/cli": "^0.16.2",
7570
"@testing-library/jest-dom": "^6.4.8",
7671
"@testing-library/react": "^16.0.0",
7772
"@types/expect": "^24.3.0",
7873
"@types/jest": "^29.5.12",
7974
"@types/json-schema": "^7.0.15",
8075
"@types/mocha": "^10.0.7",
81-
"@types/node": "^20.14.12",
76+
"@types/node": "^22.5.5",
8277
"@types/prop-types": "^15.7.12",
8378
"@types/react": "^18.3.3",
8479
"@types/react-dom": "^18.3.0",
@@ -92,19 +87,19 @@
9287
"jest": "^29.7.0",
9388
"jest-environment-jsdom": "^29.7.0",
9489
"js-yaml": "^4.1.0",
95-
"jsdom": "^24.1.1",
96-
"minimatch": "^9.0.5",
90+
"jsdom": "^25.0.0",
91+
"minimatch": "^10.0.1",
9792
"mocha": "^10.7.0",
9893
"mocha-sugar-free": "^1.4.0",
9994
"react": "^18.3.1",
10095
"react-dom": "^18.3.1",
101-
"rimraf": "^5.0.7",
96+
"rimraf": "^6.0.1",
10297
"ts-jest": "^29.2.3",
10398
"ts-jest-resolver": "^2.0.1",
10499
"ts-mocha": "^10.0.0",
105100
"ts-node": "^10.9.2",
106101
"tsup": "^8.2.2",
107102
"typescript": "^5.5.4",
108-
"typescript-eslint": "^7.17.0"
103+
"typescript-eslint": "^8.5.0"
109104
}
110105
}

src/Virtual.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
AccessibilityNode,
33
createAccessibilityTree,
44
} from "./createAccessibilityTree";
5-
import type { CommandOptions, ScreenReader } from "@guidepup/guidepup";
65
import { commands, type VirtualCommands } from "./commands/index";
76
import {
87
ERR_VIRTUAL_MISSING_CONTAINER,
@@ -74,7 +73,7 @@ export interface Root {
7473
MutationObserver?: typeof MutationObserver;
7574
}
7675

77-
export interface StartOptions extends CommandOptions {
76+
export interface StartOptions {
7877
/**
7978
* The bounding HTML element to use the Virtual Screen Reader in.
8079
*
@@ -200,7 +199,7 @@ const defaultUserEventOptions = {
200199
* });
201200
* ```
202201
*/
203-
export class Virtual implements ScreenReader {
202+
export class Virtual {
204203
#activeNode: AccessibilityNode | null = null;
205204
#container: Node | null = null;
206205
#cursor: HTMLDivElement | null = null;
@@ -328,15 +327,14 @@ export class Virtual implements ScreenReader {
328327
// We've covered the tree having no length so there must be at least one
329328
// index or we default back to the beginning of the tree.
330329
const newActiveNode =
331-
332330
tree.find(({ node }) => node === target) ?? tree.at(0)!;
333331

334332
this.#updateState(newActiveNode, true);
335333
}
336334

337335
#focusActiveElement() {
338336
// Is only called following a null guard for `this.#activeNode`.
339-
337+
340338
const target = getElementNode(this.#activeNode!);
341339
target?.focus();
342340
}
@@ -426,7 +424,7 @@ export class Virtual implements ScreenReader {
426424
// This only fires after keyboard like interactions, both of which null
427425
// guard the `this.#activeNode` so it stands that we should still be able
428426
// to find it in the tree.
429-
427+
430428
const newActiveNode = tree.at(currentIndex)!;
431429

432430
this.#updateState(newActiveNode, ignoreIfNoChange);
@@ -700,7 +698,7 @@ export class Virtual implements ScreenReader {
700698
const nextIndex = currentIndex === -1 ? 0 : currentIndex - 1;
701699
// We've covered the tree having no length so there must be at least one
702700
// index, and we ensure to zero-guard with the logic above.
703-
701+
704702
const newActiveNode = tree.at(nextIndex)!;
705703

706704
this.#updateState(newActiveNode);
@@ -745,7 +743,7 @@ export class Virtual implements ScreenReader {
745743
: currentIndex + 1;
746744
// We've covered the tree having no length so there must be at least one
747745
// index, and we ensure to zero-guard with the logic above.
748-
746+
749747
const newActiveNode = tree.at(nextIndex)!;
750748

751749
this.#updateState(newActiveNode);
@@ -966,7 +964,7 @@ export class Virtual implements ScreenReader {
966964
async perform<
967965
T extends keyof VirtualCommands,
968966
K extends Omit<Parameters<VirtualCommands[T]>[0], keyof VirtualCommandArgs>
969-
>(command: T, options?: { [L in keyof K]: K[L] } & CommandOptions) {
967+
>(command: T, options?: { [L in keyof K]: K[L] }) {
970968
this.#checkContainer();
971969
await tick();
972970

@@ -980,7 +978,7 @@ export class Virtual implements ScreenReader {
980978
const nextIndex = commands[command]?.({
981979
...options,
982980
// `this.#checkContainer();` above null guards us here.
983-
981+
984982
container: this.#container!,
985983
currentIndex,
986984
tree,
@@ -992,7 +990,7 @@ export class Virtual implements ScreenReader {
992990

993991
// We know the tree has length, and we guard against the command not being
994992
// able to find an index in the tree so we are fine.
995-
993+
996994
const newActiveNode = tree.at(nextIndex)!;
997995
this.#updateState(newActiveNode);
998996

test/int/ariaLive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
2-
2+
/* eslint-disable @typescript-eslint/no-require-imports */
33

44
const { default: userEvent } = require("@testing-library/user-event");
55

test/int/ariaModal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
/**
42
* @namespace aria
53
*/
@@ -203,7 +201,7 @@ aria.Utils = aria.Utils || {};
203201
aria.Utils.IgnoreUtilFocusChanges = true;
204202
try {
205203
element.focus();
206-
} catch (e) {
204+
} catch {
207205
// continue regardless of error
208206
}
209207
aria.Utils.IgnoreUtilFocusChanges = false;

test/int/noMutationObserver.int.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
/* eslint-disable @typescript-eslint/no-require-imports */
13
(window.MutationObserver as unknown) = undefined;
2-
// eslint-disable-next-line @typescript-eslint/no-var-requires
34
const { virtual } = require("../../src");
45

56
describe("No Mutation Observer", () => {

0 commit comments

Comments
 (0)