@react-aria/test-utils 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +5 -5
- package/dist/main.js +9 -9
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -5
- package/dist/module.js.map +1 -1
- package/dist/private/checkboxgroup.cjs +104 -0
- package/dist/private/checkboxgroup.cjs.map +1 -0
- package/dist/private/checkboxgroup.js +99 -0
- package/dist/private/checkboxgroup.js.map +1 -0
- package/dist/{combobox.main.js → private/combobox.cjs} +35 -35
- package/dist/private/combobox.cjs.map +1 -0
- package/dist/{combobox.mjs → private/combobox.js} +35 -35
- package/dist/private/combobox.js.map +1 -0
- package/dist/private/dialog.cjs +105 -0
- package/dist/private/dialog.cjs.map +1 -0
- package/dist/private/dialog.js +100 -0
- package/dist/private/dialog.js.map +1 -0
- package/dist/{events.main.js → private/events.cjs} +32 -34
- package/dist/private/events.cjs.map +1 -0
- package/dist/{events.mjs → private/events.js} +29 -31
- package/dist/private/events.js.map +1 -0
- package/dist/{gridlist.main.js → private/gridlist.cjs} +27 -28
- package/dist/private/gridlist.cjs.map +1 -0
- package/dist/{gridlist.mjs → private/gridlist.js} +27 -28
- package/dist/private/gridlist.js.map +1 -0
- package/dist/{listbox.main.js → private/listbox.cjs} +24 -24
- package/dist/private/listbox.cjs.map +1 -0
- package/dist/{listbox.mjs → private/listbox.js} +24 -24
- package/dist/private/listbox.js.map +1 -0
- package/dist/{menu.main.js → private/menu.cjs} +46 -48
- package/dist/private/menu.cjs.map +1 -0
- package/dist/{menu.mjs → private/menu.js} +46 -48
- package/dist/private/menu.js.map +1 -0
- package/dist/private/radiogroup.cjs +120 -0
- package/dist/private/radiogroup.cjs.map +1 -0
- package/dist/private/radiogroup.js +115 -0
- package/dist/private/radiogroup.js.map +1 -0
- package/dist/{select.main.js → private/select.cjs} +31 -29
- package/dist/private/select.cjs.map +1 -0
- package/dist/{select.mjs → private/select.js} +31 -29
- package/dist/private/select.js.map +1 -0
- package/dist/{table.main.js → private/table.cjs} +82 -57
- package/dist/private/table.cjs.map +1 -0
- package/dist/{table.module.js → private/table.js} +82 -57
- package/dist/private/table.js.map +1 -0
- package/dist/{tabs.main.js → private/tabs.cjs} +24 -26
- package/dist/private/tabs.cjs.map +1 -0
- package/dist/{tabs.mjs → private/tabs.js} +24 -26
- package/dist/private/tabs.js.map +1 -0
- package/dist/private/testSetup.cjs +87 -0
- package/dist/private/testSetup.cjs.map +1 -0
- package/dist/private/testSetup.js +81 -0
- package/dist/private/testSetup.js.map +1 -0
- package/dist/{tree.main.js → private/tree.cjs} +34 -35
- package/dist/private/tree.cjs.map +1 -0
- package/dist/{tree.mjs → private/tree.js} +34 -35
- package/dist/private/tree.js.map +1 -0
- package/dist/private/user.cjs +85 -0
- package/dist/private/user.cjs.map +1 -0
- package/dist/private/user.js +76 -0
- package/dist/private/user.js.map +1 -0
- package/dist/{userEventMaps.main.js → private/userEventMaps.cjs} +3 -3
- package/dist/{userEventMaps.main.js.map → private/userEventMaps.cjs.map} +1 -1
- package/dist/{userEventMaps.mjs → private/userEventMaps.js} +3 -3
- package/dist/{userEventMaps.module.js.map → private/userEventMaps.js.map} +1 -1
- package/dist/types/src/checkboxgroup.d.ts +45 -0
- package/dist/types/src/combobox.d.ts +75 -0
- package/dist/types/src/dialog.d.ts +36 -0
- package/dist/types/src/events.d.ts +25 -0
- package/dist/types/src/gridlist.d.ts +51 -0
- package/dist/types/src/index.d.ts +16 -0
- package/dist/types/src/listbox.d.ts +80 -0
- package/dist/types/src/menu.d.ts +102 -0
- package/dist/types/src/radiogroup.d.ts +46 -0
- package/dist/types/src/select.d.ts +67 -0
- package/dist/types/src/table.d.ts +104 -0
- package/dist/types/src/tabs.d.ts +58 -0
- package/dist/types/src/testSetup.d.ts +6 -0
- package/dist/types/src/tree.d.ts +57 -0
- package/dist/types/src/types.d.ts +136 -0
- package/dist/types/src/user.d.ts +47 -0
- package/dist/types/src/userEventMaps.d.ts +2 -0
- package/package.json +7 -7
- package/src/checkboxgroup.ts +158 -0
- package/src/dialog.ts +143 -0
- package/src/index.ts +11 -0
- package/src/radiogroup.ts +176 -0
- package/src/select.ts +10 -2
- package/src/table.ts +46 -1
- package/src/tabs.ts +7 -2
- package/src/testSetup.ts +30 -28
- package/src/types.ts +21 -0
- package/src/user.ts +25 -7
- package/dist/combobox.main.js.map +0 -1
- package/dist/combobox.module.js +0 -167
- package/dist/combobox.module.js.map +0 -1
- package/dist/events.main.js.map +0 -1
- package/dist/events.module.js +0 -112
- package/dist/events.module.js.map +0 -1
- package/dist/gridlist.main.js.map +0 -1
- package/dist/gridlist.module.js +0 -149
- package/dist/gridlist.module.js.map +0 -1
- package/dist/listbox.main.js.map +0 -1
- package/dist/listbox.module.js +0 -138
- package/dist/listbox.module.js.map +0 -1
- package/dist/menu.main.js.map +0 -1
- package/dist/menu.module.js +0 -269
- package/dist/menu.module.js.map +0 -1
- package/dist/select.main.js.map +0 -1
- package/dist/select.module.js +0 -158
- package/dist/select.module.js.map +0 -1
- package/dist/table.main.js.map +0 -1
- package/dist/table.mjs +0 -290
- package/dist/table.module.js.map +0 -1
- package/dist/tabs.main.js.map +0 -1
- package/dist/tabs.module.js +0 -128
- package/dist/tabs.module.js.map +0 -1
- package/dist/testSetup.main.js +0 -78
- package/dist/testSetup.main.js.map +0 -1
- package/dist/testSetup.mjs +0 -72
- package/dist/testSetup.module.js +0 -72
- package/dist/testSetup.module.js.map +0 -1
- package/dist/tree.main.js.map +0 -1
- package/dist/tree.module.js +0 -179
- package/dist/tree.module.js.map +0 -1
- package/dist/types.d.ts +0 -694
- package/dist/types.d.ts.map +0 -1
- package/dist/user.main.js +0 -76
- package/dist/user.main.js.map +0 -1
- package/dist/user.mjs +0 -67
- package/dist/user.module.js +0 -67
- package/dist/user.module.js.map +0 -1
- package/dist/userEventMaps.module.js +0 -38
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GridListTesterOpts, GridRowActionOpts, ToggleGridRowOpts, UserOpts } from './types';
|
|
2
|
+
interface GridListToggleRowOpts extends ToggleGridRowOpts {
|
|
3
|
+
}
|
|
4
|
+
interface GridListRowActionOpts extends GridRowActionOpts {
|
|
5
|
+
}
|
|
6
|
+
export declare class GridListTester {
|
|
7
|
+
private user;
|
|
8
|
+
private _interactionType;
|
|
9
|
+
private _advanceTimer;
|
|
10
|
+
private _gridlist;
|
|
11
|
+
constructor(opts: GridListTesterOpts);
|
|
12
|
+
/**
|
|
13
|
+
* Set the interaction type used by the gridlist tester.
|
|
14
|
+
*/
|
|
15
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a row matching the specified index or text content.
|
|
18
|
+
*/
|
|
19
|
+
findRow(opts: {
|
|
20
|
+
rowIndexOrText: number | string;
|
|
21
|
+
}): HTMLElement;
|
|
22
|
+
private keyboardNavigateToRow;
|
|
23
|
+
/**
|
|
24
|
+
* Toggles the selection for the specified gridlist row. Defaults to using the interaction type set on the gridlist tester.
|
|
25
|
+
* Note that this will endevor to always add/remove JUST the provided row to the set of selected rows.
|
|
26
|
+
*/
|
|
27
|
+
toggleRowSelection(opts: GridListToggleRowOpts): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Triggers the action for the specified gridlist row. Defaults to using the interaction type set on the gridlist tester.
|
|
30
|
+
*/
|
|
31
|
+
triggerRowAction(opts: GridListRowActionOpts): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the gridlist.
|
|
34
|
+
*/
|
|
35
|
+
get gridlist(): HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the gridlist's rows if any.
|
|
38
|
+
*/
|
|
39
|
+
get rows(): HTMLElement[];
|
|
40
|
+
/**
|
|
41
|
+
* Returns the gridlist's selected rows if any.
|
|
42
|
+
*/
|
|
43
|
+
get selectedRows(): HTMLElement[];
|
|
44
|
+
/**
|
|
45
|
+
* Returns the gridlist's cells if any. Can be filtered against a specific row if provided via `element`.
|
|
46
|
+
*/
|
|
47
|
+
cells(opts?: {
|
|
48
|
+
element?: HTMLElement;
|
|
49
|
+
}): HTMLElement[];
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { triggerLongPress } from './events';
|
|
2
|
+
export { installMouseEvent, installPointerEvent } from './testSetup';
|
|
3
|
+
export { pointerMap } from './userEventMaps';
|
|
4
|
+
export { User } from './user';
|
|
5
|
+
export type { CheckboxGroupTester } from './checkboxgroup';
|
|
6
|
+
export type { ComboBoxTester } from './combobox';
|
|
7
|
+
export type { DialogTester } from './dialog';
|
|
8
|
+
export type { GridListTester } from './gridlist';
|
|
9
|
+
export type { ListBoxTester } from './listbox';
|
|
10
|
+
export type { MenuTester } from './menu';
|
|
11
|
+
export type { RadioGroupTester } from './radiogroup';
|
|
12
|
+
export type { SelectTester } from './select';
|
|
13
|
+
export type { TableTester } from './table';
|
|
14
|
+
export type { TabsTester } from './tabs';
|
|
15
|
+
export type { TreeTester } from './tree';
|
|
16
|
+
export type { UserOpts } from './types';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ListBoxTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface ListBoxToggleOptionOpts {
|
|
3
|
+
/**
|
|
4
|
+
* What interaction type to use when toggling selection for an option. Defaults to the interaction type set on the tester.
|
|
5
|
+
*/
|
|
6
|
+
interactionType?: UserOpts['interactionType'];
|
|
7
|
+
/**
|
|
8
|
+
* The index, text, or node of the option to toggle selection for.
|
|
9
|
+
*/
|
|
10
|
+
option: number | string | HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the option should be triggered by Space or Enter in keyboard modality.
|
|
13
|
+
* @default 'Enter'
|
|
14
|
+
*/
|
|
15
|
+
keyboardActivation?: 'Space' | 'Enter';
|
|
16
|
+
/**
|
|
17
|
+
* Whether the option needs to be long pressed to be selected. Depends on the listbox's implementation.
|
|
18
|
+
*/
|
|
19
|
+
needsLongPress?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the listbox has a selectionBehavior of "toggle" or "replace" (aka highlight selection). This affects the user operations
|
|
22
|
+
* required to toggle option selection by adding modifier keys during user actions, useful when performing multi-option selection in a "selectionBehavior: 'replace'" listbox.
|
|
23
|
+
* If you would like to still simulate user actions (aka press) without these modifiers keys for a "selectionBehavior: replace" listbox, simply omit this option.
|
|
24
|
+
* See the [RAC Listbox docs](https://react-spectrum.adobe.com/react-aria/ListBox.html#selection-behavior) for more info on this behavior.
|
|
25
|
+
*
|
|
26
|
+
* @default 'toggle'
|
|
27
|
+
*/
|
|
28
|
+
selectionBehavior?: 'toggle' | 'replace';
|
|
29
|
+
}
|
|
30
|
+
interface ListBoxOptionActionOpts extends Omit<ListBoxToggleOptionOpts, 'keyboardActivation' | 'needsLongPress'> {
|
|
31
|
+
/**
|
|
32
|
+
* Whether or not the option needs a double click to trigger the option action. Depends on the listbox's implementation.
|
|
33
|
+
*/
|
|
34
|
+
needsDoubleClick?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare class ListBoxTester {
|
|
37
|
+
private user;
|
|
38
|
+
private _interactionType;
|
|
39
|
+
private _advanceTimer;
|
|
40
|
+
private _listbox;
|
|
41
|
+
constructor(opts: ListBoxTesterOpts);
|
|
42
|
+
/**
|
|
43
|
+
* Set the interaction type used by the listbox tester.
|
|
44
|
+
*/
|
|
45
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
46
|
+
/**
|
|
47
|
+
* Returns a option matching the specified index or text content.
|
|
48
|
+
*/
|
|
49
|
+
findOption(opts: {
|
|
50
|
+
optionIndexOrText: number | string;
|
|
51
|
+
}): HTMLElement;
|
|
52
|
+
private keyboardNavigateToOption;
|
|
53
|
+
/**
|
|
54
|
+
* Toggles the selection for the specified listbox option. Defaults to using the interaction type set on the listbox tester.
|
|
55
|
+
*/
|
|
56
|
+
toggleOptionSelection(opts: ListBoxToggleOptionOpts): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Triggers the action for the specified listbox option. Defaults to using the interaction type set on the listbox tester.
|
|
59
|
+
*/
|
|
60
|
+
triggerOptionAction(opts: ListBoxOptionActionOpts): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the listbox.
|
|
63
|
+
*/
|
|
64
|
+
get listbox(): HTMLElement;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the listbox options. Can be filtered to a subsection of the listbox if provided via `element`.
|
|
67
|
+
*/
|
|
68
|
+
options(opts?: {
|
|
69
|
+
element?: HTMLElement;
|
|
70
|
+
}): HTMLElement[];
|
|
71
|
+
/**
|
|
72
|
+
* Returns the listbox's selected options if any.
|
|
73
|
+
*/
|
|
74
|
+
get selectedOptions(): HTMLElement[];
|
|
75
|
+
/**
|
|
76
|
+
* Returns the listbox's sections if any.
|
|
77
|
+
*/
|
|
78
|
+
get sections(): HTMLElement[];
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { MenuTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface MenuOpenOpts {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the menu needs to be long pressed to open.
|
|
5
|
+
*/
|
|
6
|
+
needsLongPress?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* What interaction type to use when opening the menu. Defaults to the interaction type set on the tester.
|
|
9
|
+
*/
|
|
10
|
+
interactionType?: UserOpts['interactionType'];
|
|
11
|
+
/**
|
|
12
|
+
* Whether to open the menu via ArrowUp or ArrowDown if in keyboard modality.
|
|
13
|
+
*/
|
|
14
|
+
direction?: 'up' | 'down';
|
|
15
|
+
}
|
|
16
|
+
interface MenuSelectOpts extends MenuOpenOpts {
|
|
17
|
+
/**
|
|
18
|
+
* The index, text, or node of the option to select. Option nodes can be sourced via `options()`.
|
|
19
|
+
*/
|
|
20
|
+
option: number | string | HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* The menu's selection mode. Will affect whether or not the menu is expected to be closed upon option selection.
|
|
23
|
+
* @default 'single'
|
|
24
|
+
*/
|
|
25
|
+
menuSelectionMode?: 'single' | 'multiple';
|
|
26
|
+
/**
|
|
27
|
+
* Whether or not the menu closes on select. Depends on menu implementation and configuration.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
closesOnSelect?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the option should be triggered by Space or Enter in keyboard modality.
|
|
33
|
+
* @default 'Enter'
|
|
34
|
+
*/
|
|
35
|
+
keyboardActivation?: 'Space' | 'Enter';
|
|
36
|
+
}
|
|
37
|
+
interface MenuOpenSubmenuOpts extends MenuOpenOpts {
|
|
38
|
+
/**
|
|
39
|
+
* The text or node of the submenu trigger to open. Available submenu trigger nodes can be sourced via `submenuTriggers`.
|
|
40
|
+
*/
|
|
41
|
+
submenuTrigger: string | HTMLElement;
|
|
42
|
+
}
|
|
43
|
+
export declare class MenuTester {
|
|
44
|
+
private user;
|
|
45
|
+
private _interactionType;
|
|
46
|
+
private _advanceTimer;
|
|
47
|
+
private _trigger;
|
|
48
|
+
private _isSubmenu;
|
|
49
|
+
private _rootMenu;
|
|
50
|
+
constructor(opts: MenuTesterOpts);
|
|
51
|
+
/**
|
|
52
|
+
* Set the interaction type used by the menu tester.
|
|
53
|
+
*/
|
|
54
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
55
|
+
/**
|
|
56
|
+
* Opens the menu. Defaults to using the interaction type set on the menu tester.
|
|
57
|
+
*/
|
|
58
|
+
open(opts?: MenuOpenOpts): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a option matching the specified index or text content.
|
|
61
|
+
*/
|
|
62
|
+
findOption(opts: {
|
|
63
|
+
optionIndexOrText: number | string;
|
|
64
|
+
}): HTMLElement;
|
|
65
|
+
/**
|
|
66
|
+
* Selects the desired menu option. Defaults to using the interaction type set on the menu tester. If necessary, will open the menu dropdown beforehand.
|
|
67
|
+
* The desired option can be targeted via the option's node, the option's text, or the option's index.
|
|
68
|
+
*/
|
|
69
|
+
selectOption(opts: MenuSelectOpts): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Opens the submenu. Defaults to using the interaction type set on the menu tester. The submenu trigger can be targeted via the trigger's node or the trigger's text.
|
|
72
|
+
*/
|
|
73
|
+
openSubmenu(opts: MenuOpenSubmenuOpts): Promise<MenuTester | null>;
|
|
74
|
+
private keyboardNavigateToOption;
|
|
75
|
+
/**
|
|
76
|
+
* Closes the menu.
|
|
77
|
+
*/
|
|
78
|
+
close(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the menu's trigger.
|
|
81
|
+
*/
|
|
82
|
+
get trigger(): HTMLElement;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the menu if present.
|
|
85
|
+
*/
|
|
86
|
+
get menu(): HTMLElement | null;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the menu's sections if any.
|
|
89
|
+
*/
|
|
90
|
+
get sections(): HTMLElement[];
|
|
91
|
+
/**
|
|
92
|
+
* Returns the menu's options if present. Can be filtered to a subsection of the menu if provided via `element`.
|
|
93
|
+
*/
|
|
94
|
+
options(opts?: {
|
|
95
|
+
element?: HTMLElement;
|
|
96
|
+
}): HTMLElement[];
|
|
97
|
+
/**
|
|
98
|
+
* Returns the menu's submenu triggers if any.
|
|
99
|
+
*/
|
|
100
|
+
get submenuTriggers(): HTMLElement[];
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RadioGroupTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface TriggerRadioOptions {
|
|
3
|
+
/**
|
|
4
|
+
* What interaction type to use when triggering a radio. Defaults to the interaction type set on the tester.
|
|
5
|
+
*/
|
|
6
|
+
interactionType?: UserOpts['interactionType'];
|
|
7
|
+
/**
|
|
8
|
+
* The index, text, or node of the radio to toggle selection for.
|
|
9
|
+
*/
|
|
10
|
+
radio: number | string | HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
export declare class RadioGroupTester {
|
|
13
|
+
private user;
|
|
14
|
+
private _interactionType;
|
|
15
|
+
private _radiogroup;
|
|
16
|
+
private _direction;
|
|
17
|
+
constructor(opts: RadioGroupTesterOpts);
|
|
18
|
+
/**
|
|
19
|
+
* Set the interaction type used by the radio tester.
|
|
20
|
+
*/
|
|
21
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a radio matching the specified index or text content.
|
|
24
|
+
*/
|
|
25
|
+
findRadio(opts: {
|
|
26
|
+
radioIndexOrText: number | string;
|
|
27
|
+
}): HTMLElement;
|
|
28
|
+
private keyboardNavigateToRadio;
|
|
29
|
+
/**
|
|
30
|
+
* Triggers the specified radio. Defaults to using the interaction type set on the radio tester.
|
|
31
|
+
*/
|
|
32
|
+
triggerRadio(opts: TriggerRadioOptions): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the radiogroup.
|
|
35
|
+
*/
|
|
36
|
+
get radiogroup(): HTMLElement;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the radios.
|
|
39
|
+
*/
|
|
40
|
+
get radios(): HTMLElement[];
|
|
41
|
+
/**
|
|
42
|
+
* Returns the currently selected radio in the radiogroup if any.
|
|
43
|
+
*/
|
|
44
|
+
get selectedRadio(): HTMLElement | null;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { SelectTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface SelectOpenOpts {
|
|
3
|
+
/**
|
|
4
|
+
* What interaction type to use when opening the select. Defaults to the interaction type set on the tester.
|
|
5
|
+
*/
|
|
6
|
+
interactionType?: UserOpts['interactionType'];
|
|
7
|
+
}
|
|
8
|
+
interface SelectTriggerOptionOpts extends SelectOpenOpts {
|
|
9
|
+
/**
|
|
10
|
+
* The index, text, or node of the option to select. Option nodes can be sourced via `options()`.
|
|
11
|
+
*/
|
|
12
|
+
option: number | string | HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* Whether or not the select closes on selection. Depends on select implementation and configuration.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
closesOnSelect?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class SelectTester {
|
|
20
|
+
private user;
|
|
21
|
+
private _interactionType;
|
|
22
|
+
private _trigger;
|
|
23
|
+
constructor(opts: SelectTesterOpts);
|
|
24
|
+
/**
|
|
25
|
+
* Set the interaction type used by the select tester.
|
|
26
|
+
*/
|
|
27
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
28
|
+
/**
|
|
29
|
+
* Opens the select. Defaults to using the interaction type set on the select tester.
|
|
30
|
+
*/
|
|
31
|
+
open(opts?: SelectOpenOpts): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Closes the select.
|
|
34
|
+
*/
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a option matching the specified index or text content.
|
|
38
|
+
*/
|
|
39
|
+
findOption(opts: {
|
|
40
|
+
optionIndexOrText: number | string;
|
|
41
|
+
}): HTMLElement;
|
|
42
|
+
private keyboardNavigateToOption;
|
|
43
|
+
/**
|
|
44
|
+
* Selects the desired select option. Defaults to using the interaction type set on the select tester. If necessary, will open the select dropdown beforehand.
|
|
45
|
+
* The desired option can be targeted via the option's node, the option's text, or the option's index.
|
|
46
|
+
*/
|
|
47
|
+
selectOption(opts: SelectTriggerOptionOpts): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the select's options if present. Can be filtered to a subsection of the listbox if provided via `element`.
|
|
50
|
+
*/
|
|
51
|
+
options(opts?: {
|
|
52
|
+
element?: HTMLElement;
|
|
53
|
+
}): HTMLElement[];
|
|
54
|
+
/**
|
|
55
|
+
* Returns the select's trigger.
|
|
56
|
+
*/
|
|
57
|
+
get trigger(): HTMLElement;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the select's listbox if present.
|
|
60
|
+
*/
|
|
61
|
+
get listbox(): HTMLElement | null;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the select's sections if present.
|
|
64
|
+
*/
|
|
65
|
+
get sections(): HTMLElement[];
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BaseGridRowInteractionOpts, GridRowActionOpts, TableTesterOpts, ToggleGridRowOpts, UserOpts } from './types';
|
|
2
|
+
interface TableToggleRowOpts extends ToggleGridRowOpts {
|
|
3
|
+
}
|
|
4
|
+
interface TableToggleExpansionOpts extends BaseGridRowInteractionOpts {
|
|
5
|
+
}
|
|
6
|
+
interface TableToggleSortOpts {
|
|
7
|
+
/**
|
|
8
|
+
* The index, text, or node of the column to toggle selection for.
|
|
9
|
+
*/
|
|
10
|
+
column: number | string | HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* What interaction type to use when sorting the column. Defaults to the interaction type set on the tester.
|
|
13
|
+
*/
|
|
14
|
+
interactionType?: UserOpts['interactionType'];
|
|
15
|
+
}
|
|
16
|
+
interface TableColumnHeaderActionOpts extends TableToggleSortOpts {
|
|
17
|
+
/**
|
|
18
|
+
* The index of the column header action to trigger.
|
|
19
|
+
*/
|
|
20
|
+
action: number;
|
|
21
|
+
}
|
|
22
|
+
interface TableRowActionOpts extends GridRowActionOpts {
|
|
23
|
+
}
|
|
24
|
+
export declare class TableTester {
|
|
25
|
+
private user;
|
|
26
|
+
private _interactionType;
|
|
27
|
+
private _advanceTimer;
|
|
28
|
+
private _table;
|
|
29
|
+
constructor(opts: TableTesterOpts);
|
|
30
|
+
/**
|
|
31
|
+
* Set the interaction type used by the table tester.
|
|
32
|
+
*/
|
|
33
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
34
|
+
private keyboardNavigateToRow;
|
|
35
|
+
/**
|
|
36
|
+
* Toggles the selection for the specified table row. Defaults to using the interaction type set on the table tester.
|
|
37
|
+
*/
|
|
38
|
+
toggleRowSelection(opts: TableToggleRowOpts): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.
|
|
41
|
+
*/
|
|
42
|
+
toggleRowExpansion(opts: TableToggleExpansionOpts): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Toggles the sort order for the specified table column. Defaults to using the interaction type set on the table tester.
|
|
45
|
+
*/
|
|
46
|
+
toggleSort(opts: TableToggleSortOpts): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Triggers an action for the specified table column menu. Defaults to using the interaction type set on the table tester.
|
|
49
|
+
*/
|
|
50
|
+
triggerColumnHeaderAction(opts: TableColumnHeaderActionOpts): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Triggers the action for the specified table row. Defaults to using the interaction type set on the table tester.
|
|
53
|
+
*/
|
|
54
|
+
triggerRowAction(opts: TableRowActionOpts): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Toggle selection for all rows in the table. Defaults to using the interaction type set on the table tester.
|
|
57
|
+
*/
|
|
58
|
+
toggleSelectAll(opts?: {
|
|
59
|
+
interactionType?: UserOpts['interactionType'];
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns a row matching the specified index or text content.
|
|
63
|
+
*/
|
|
64
|
+
findRow(opts: {
|
|
65
|
+
rowIndexOrText: number | string;
|
|
66
|
+
}): HTMLElement;
|
|
67
|
+
/**
|
|
68
|
+
* Returns a cell matching the specified text content.
|
|
69
|
+
*/
|
|
70
|
+
findCell(opts: {
|
|
71
|
+
text: string;
|
|
72
|
+
}): HTMLElement;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the table.
|
|
75
|
+
*/
|
|
76
|
+
get table(): HTMLElement;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the row groups within the table.
|
|
79
|
+
*/
|
|
80
|
+
get rowGroups(): HTMLElement[];
|
|
81
|
+
/**
|
|
82
|
+
* Returns the columns within the table.
|
|
83
|
+
*/
|
|
84
|
+
get columns(): HTMLElement[];
|
|
85
|
+
/**
|
|
86
|
+
* Returns the rows within the table if any.
|
|
87
|
+
*/
|
|
88
|
+
get rows(): HTMLElement[];
|
|
89
|
+
/**
|
|
90
|
+
* Returns the currently selected rows within the table if any.
|
|
91
|
+
*/
|
|
92
|
+
get selectedRows(): HTMLElement[];
|
|
93
|
+
/**
|
|
94
|
+
* Returns the row headers within the table if any.
|
|
95
|
+
*/
|
|
96
|
+
get rowHeaders(): HTMLElement[];
|
|
97
|
+
/**
|
|
98
|
+
* Returns the cells within the table if any. Can be filtered against a specific row if provided via `element`.
|
|
99
|
+
*/
|
|
100
|
+
cells(opts?: {
|
|
101
|
+
element?: HTMLElement;
|
|
102
|
+
}): HTMLElement[];
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TabsTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface TriggerTabOptions {
|
|
3
|
+
/**
|
|
4
|
+
* What interaction type to use when triggering a tab. Defaults to the interaction type set on the tester.
|
|
5
|
+
*/
|
|
6
|
+
interactionType?: UserOpts['interactionType'];
|
|
7
|
+
/**
|
|
8
|
+
* The index, text, or node of the tab to toggle selection for.
|
|
9
|
+
*/
|
|
10
|
+
tab: number | string | HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the tab needs to be activated manually rather than on focus.
|
|
13
|
+
*/
|
|
14
|
+
manualActivation?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class TabsTester {
|
|
17
|
+
private user;
|
|
18
|
+
private _interactionType;
|
|
19
|
+
private _tablist;
|
|
20
|
+
private _direction;
|
|
21
|
+
constructor(opts: TabsTesterOpts);
|
|
22
|
+
/**
|
|
23
|
+
* Set the interaction type used by the tabs tester.
|
|
24
|
+
*/
|
|
25
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a tab matching the specified index or text content.
|
|
28
|
+
*/
|
|
29
|
+
findTab(opts: {
|
|
30
|
+
tabIndexOrText: number | string;
|
|
31
|
+
}): HTMLElement;
|
|
32
|
+
private keyboardNavigateToTab;
|
|
33
|
+
/**
|
|
34
|
+
* Triggers the specified tab. Defaults to using the interaction type set on the tabs tester.
|
|
35
|
+
*/
|
|
36
|
+
triggerTab(opts: TriggerTabOptions): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the tablist.
|
|
39
|
+
*/
|
|
40
|
+
get tablist(): HTMLElement;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the tabpanels.
|
|
43
|
+
*/
|
|
44
|
+
get tabpanels(): HTMLElement[];
|
|
45
|
+
/**
|
|
46
|
+
* Returns the tabs in the tablist.
|
|
47
|
+
*/
|
|
48
|
+
get tabs(): HTMLElement[];
|
|
49
|
+
/**
|
|
50
|
+
* Returns the currently selected tab in the tablist if any.
|
|
51
|
+
*/
|
|
52
|
+
get selectedTab(): HTMLElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the currently active tabpanel if any.
|
|
55
|
+
*/
|
|
56
|
+
get activeTabpanel(): HTMLElement | null;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts } from './types';
|
|
2
|
+
interface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {
|
|
3
|
+
}
|
|
4
|
+
interface TreeToggleRowOpts extends ToggleGridRowOpts {
|
|
5
|
+
}
|
|
6
|
+
interface TreeRowActionOpts extends GridRowActionOpts {
|
|
7
|
+
}
|
|
8
|
+
export declare class TreeTester {
|
|
9
|
+
private user;
|
|
10
|
+
private _interactionType;
|
|
11
|
+
private _advanceTimer;
|
|
12
|
+
private _tree;
|
|
13
|
+
constructor(opts: TreeTesterOpts);
|
|
14
|
+
/**
|
|
15
|
+
* Set the interaction type used by the tree tester.
|
|
16
|
+
*/
|
|
17
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
18
|
+
/**
|
|
19
|
+
* Returns a row matching the specified index or text content.
|
|
20
|
+
*/
|
|
21
|
+
findRow(opts: {
|
|
22
|
+
rowIndexOrText: number | string;
|
|
23
|
+
}): HTMLElement;
|
|
24
|
+
private keyboardNavigateToRow;
|
|
25
|
+
/**
|
|
26
|
+
* Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.
|
|
27
|
+
* Note that this will endevor to always add/remove JUST the provided row to the set of selected rows.
|
|
28
|
+
*/
|
|
29
|
+
toggleRowSelection(opts: TreeToggleRowOpts): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.
|
|
32
|
+
*/
|
|
33
|
+
toggleRowExpansion(opts: TreeToggleExpansionOpts): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.
|
|
36
|
+
*/
|
|
37
|
+
triggerRowAction(opts: TreeRowActionOpts): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the tree.
|
|
40
|
+
*/
|
|
41
|
+
get tree(): HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the tree's rows if any.
|
|
44
|
+
*/
|
|
45
|
+
get rows(): HTMLElement[];
|
|
46
|
+
/**
|
|
47
|
+
* Returns the tree's selected rows if any.
|
|
48
|
+
*/
|
|
49
|
+
get selectedRows(): HTMLElement[];
|
|
50
|
+
/**
|
|
51
|
+
* Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.
|
|
52
|
+
*/
|
|
53
|
+
cells(opts?: {
|
|
54
|
+
element?: HTMLElement;
|
|
55
|
+
}): HTMLElement[];
|
|
56
|
+
}
|
|
57
|
+
export {};
|