@react-aria/test-utils 1.0.0-beta.1 → 1.0.0-beta.2
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/checkboxgroup.main.js +104 -0
- package/dist/checkboxgroup.main.js.map +1 -0
- package/dist/checkboxgroup.mjs +99 -0
- package/dist/checkboxgroup.module.js +99 -0
- package/dist/checkboxgroup.module.js.map +1 -0
- package/dist/dialog.main.js +105 -0
- package/dist/dialog.main.js.map +1 -0
- package/dist/dialog.mjs +100 -0
- package/dist/dialog.module.js +100 -0
- package/dist/dialog.module.js.map +1 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/dist/radiogroup.main.js +123 -0
- package/dist/radiogroup.main.js.map +1 -0
- package/dist/radiogroup.mjs +118 -0
- package/dist/radiogroup.module.js +118 -0
- package/dist/radiogroup.module.js.map +1 -0
- package/dist/tabs.main.js +5 -3
- package/dist/tabs.main.js.map +1 -1
- package/dist/tabs.mjs +5 -3
- package/dist/tabs.module.js +5 -3
- package/dist/tabs.module.js.map +1 -1
- package/dist/testSetup.main.js +29 -28
- package/dist/testSetup.main.js.map +1 -1
- package/dist/testSetup.mjs +30 -29
- package/dist/testSetup.module.js +30 -29
- package/dist/testSetup.module.js.map +1 -1
- package/dist/types.d.ts +142 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/user.main.js +12 -3
- package/dist/user.main.js.map +1 -1
- package/dist/user.mjs +12 -3
- package/dist/user.module.js +12 -3
- package/dist/user.module.js.map +1 -1
- package/package.json +2 -2
- 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/tabs.ts +7 -2
- package/src/testSetup.ts +30 -28
- package/src/types.ts +21 -0
- package/src/user.ts +25 -7
package/dist/tabs.mjs
CHANGED
|
@@ -34,17 +34,19 @@ class $e615c34a00448a49$export$f1539bff3fc7d485 {
|
|
|
34
34
|
async keyboardNavigateToTab(opts) {
|
|
35
35
|
let { tab: tab, orientation: orientation = 'vertical' } = opts;
|
|
36
36
|
let tabs = this.tabs;
|
|
37
|
+
tabs = tabs.filter((tab)=>!(tab.hasAttribute('disabled') || tab.getAttribute('aria-disabled') === 'true'));
|
|
38
|
+
if (tabs.length === 0) throw new Error('Tablist doesnt have any non-disabled tabs. Please double check your tabs implementation.');
|
|
37
39
|
let targetIndex = tabs.indexOf(tab);
|
|
38
40
|
if (targetIndex === -1) throw new Error('Tab provided is not in the tablist');
|
|
39
41
|
if (!this._tablist.contains(document.activeElement)) {
|
|
40
42
|
let selectedTab = this.selectedTab;
|
|
41
43
|
if (selectedTab != null) (0, $im2y9$act)(()=>selectedTab.focus());
|
|
42
44
|
else (0, $im2y9$act)(()=>{
|
|
43
|
-
var
|
|
44
|
-
return (
|
|
45
|
+
var _tabs_;
|
|
46
|
+
return (_tabs_ = tabs[0]) === null || _tabs_ === void 0 ? void 0 : _tabs_.focus();
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
|
-
let currIndex =
|
|
49
|
+
let currIndex = tabs.indexOf(document.activeElement);
|
|
48
50
|
if (currIndex === -1) throw new Error('ActiveElement is not in the tablist');
|
|
49
51
|
let arrowUp = 'ArrowUp';
|
|
50
52
|
let arrowDown = 'ArrowDown';
|
package/dist/tabs.module.js
CHANGED
|
@@ -34,17 +34,19 @@ class $e615c34a00448a49$export$f1539bff3fc7d485 {
|
|
|
34
34
|
async keyboardNavigateToTab(opts) {
|
|
35
35
|
let { tab: tab, orientation: orientation = 'vertical' } = opts;
|
|
36
36
|
let tabs = this.tabs;
|
|
37
|
+
tabs = tabs.filter((tab)=>!(tab.hasAttribute('disabled') || tab.getAttribute('aria-disabled') === 'true'));
|
|
38
|
+
if (tabs.length === 0) throw new Error('Tablist doesnt have any non-disabled tabs. Please double check your tabs implementation.');
|
|
37
39
|
let targetIndex = tabs.indexOf(tab);
|
|
38
40
|
if (targetIndex === -1) throw new Error('Tab provided is not in the tablist');
|
|
39
41
|
if (!this._tablist.contains(document.activeElement)) {
|
|
40
42
|
let selectedTab = this.selectedTab;
|
|
41
43
|
if (selectedTab != null) (0, $im2y9$act)(()=>selectedTab.focus());
|
|
42
44
|
else (0, $im2y9$act)(()=>{
|
|
43
|
-
var
|
|
44
|
-
return (
|
|
45
|
+
var _tabs_;
|
|
46
|
+
return (_tabs_ = tabs[0]) === null || _tabs_ === void 0 ? void 0 : _tabs_.focus();
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
|
-
let currIndex =
|
|
49
|
+
let currIndex = tabs.indexOf(document.activeElement);
|
|
48
50
|
if (currIndex === -1) throw new Error('ActiveElement is not in the tablist');
|
|
49
51
|
let arrowUp = 'ArrowUp';
|
|
50
52
|
let arrowDown = 'ArrowDown';
|
package/dist/tabs.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAqBM,MAAM;IAmBX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA,mFAAmF;IACnF;;GAEC,GACD,QAAQ,IAAuC,EAAe;QAC5D,IAAI,kBACF,cAAc,EACf,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,OAAO,mBAAmB,UAC5B,MAAM,IAAI,CAAC,eAAe;aACrB,IAAI,OAAO,mBAAmB,UACnC,MAAO,CAAA,GAAA,aAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,gBAAgB,OAAO,CAAC;QAGjE,OAAO;IACT;IAEA,+FAA+F;IAC/F,MAAc,sBAAsB,IAAmD,EAAE;QACvF,IAAI,OAAC,GAAG,eAAE,cAAc,YAAW,GAAG;QACtC,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,cAAc,KAAK,OAAO,CAAC;QAC/B,IAAI,gBAAgB,IAClB,MAAM,IAAI,MAAM;QAGlB,I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C1C,IAAI,QAAQ,MAAM,GAAG,GACnB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,EAAE;IAE9B;AA0JF","sources":["packages/@react-aria/test-utils/src/tabs.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act, within} from '@testing-library/react';\nimport {Direction, Orientation, TabsTesterOpts, UserOpts} from './types';\nimport {pressElement} from './events';\n\ninterface TriggerTabOptions {\n /**\n * What interaction type to use when triggering a tab. Defaults to the interaction type set on the tester.\n */\n interactionType?: UserOpts['interactionType'],\n /**\n * The index, text, or node of the tab to toggle selection for.\n */\n tab: number | string | HTMLElement,\n /**\n * Whether the tab needs to be activated manually rather than on focus.\n */\n manualActivation?: boolean\n}\n\nexport class TabsTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _tablist: HTMLElement;\n private _direction: Direction;\n\n constructor(opts: TabsTesterOpts) {\n let {root, user, interactionType, direction} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._direction = direction || 'ltr';\n\n this._tablist = root;\n let tablist = within(root).queryAllByRole('tablist');\n if (tablist.length > 0) {\n this._tablist = tablist[0];\n }\n }\n\n /**\n * Set the interaction type used by the tabs tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n }\n\n // TODO: This is pretty similar across most the utils, refactor to make it generic?\n /**\n * Returns a tab matching the specified index or text content.\n */\n findTab(opts: {tabIndexOrText: number | string}): HTMLElement {\n let {\n tabIndexOrText\n } = opts;\n\n let tab;\n let tabs = this.tabs;\n if (typeof tabIndexOrText === 'number') {\n tab = tabs[tabIndexOrText];\n } else if (typeof tabIndexOrText === 'string') {\n tab = (within(this._tablist).getByText(tabIndexOrText).closest('[role=tab]'))! as HTMLElement;\n }\n\n return tab;\n }\n\n // TODO: also quite similar across more utils albeit with orientation, refactor to make generic\n private async keyboardNavigateToTab(opts: {tab: HTMLElement, orientation?: Orientation}) {\n let {tab, orientation = 'vertical'} = opts;\n let tabs = this.tabs;\n tabs = tabs.filter(tab => !(tab.hasAttribute('disabled') || tab.getAttribute('aria-disabled') === 'true'));\n if (tabs.length === 0) {\n throw new Error('Tablist doesnt have any non-disabled tabs. Please double check your tabs implementation.');\n }\n\n let targetIndex = tabs.indexOf(tab);\n if (targetIndex === -1) {\n throw new Error('Tab provided is not in the tablist');\n }\n\n if (!this._tablist.contains(document.activeElement)) {\n let selectedTab = this.selectedTab;\n if (selectedTab != null) {\n act(() => selectedTab.focus());\n } else {\n act(() => tabs[0]?.focus());\n }\n }\n\n let currIndex = tabs.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tablist');\n }\n\n let arrowUp = 'ArrowUp';\n let arrowDown = 'ArrowDown';\n if (orientation === 'horizontal') {\n if (this._direction === 'ltr') {\n arrowUp = 'ArrowLeft';\n arrowDown = 'ArrowRight';\n } else {\n arrowUp = 'ArrowRight';\n arrowDown = 'ArrowLeft';\n }\n }\n\n let movementDirection = targetIndex > currIndex ? 'down' : 'up';\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${movementDirection === 'down' ? arrowDown : arrowUp}]`);\n }\n };\n\n /**\n * Triggers the specified tab. Defaults to using the interaction type set on the tabs tester.\n */\n async triggerTab(opts: TriggerTabOptions): Promise<void> {\n let {\n tab,\n interactionType = this._interactionType,\n manualActivation\n } = opts;\n\n if (typeof tab === 'string' || typeof tab === 'number') {\n tab = this.findTab({tabIndexOrText: tab});\n }\n\n if (!tab) {\n throw new Error('Target tab not found in the tablist.');\n } else if (tab.hasAttribute('disabled')) {\n throw new Error('Target tab is disabled.');\n }\n\n if (interactionType === 'keyboard') {\n if (document.activeElement !== this._tablist && !this._tablist.contains(document.activeElement)) {\n act(() => this._tablist.focus());\n }\n\n let tabsOrientation = this._tablist.getAttribute('aria-orientation') || 'horizontal';\n await this.keyboardNavigateToTab({tab, orientation: tabsOrientation as Orientation});\n if (manualActivation) {\n await this.user.keyboard('[Enter]');\n }\n } else {\n await pressElement(this.user, tab, interactionType);\n }\n }\n\n /**\n * Returns the tablist.\n */\n get tablist(): HTMLElement {\n return this._tablist;\n }\n\n /**\n * Returns the tabpanels.\n */\n get tabpanels(): HTMLElement[] {\n let tabpanels = [] as HTMLElement[];\n for (let tab of this.tabs) {\n let controlId = tab.getAttribute('aria-controls');\n let panel = controlId != null ? document.getElementById(controlId) : null;\n if (panel != null) {\n tabpanels.push(panel);\n }\n }\n\n return tabpanels;\n }\n\n /**\n * Returns the tabs in the tablist.\n */\n get tabs(): HTMLElement[] {\n return within(this.tablist).queryAllByRole('tab');\n }\n\n /**\n * Returns the currently selected tab in the tablist if any.\n */\n get selectedTab(): HTMLElement | null {\n return this.tabs.find(tab => tab.getAttribute('aria-selected') === 'true') || null;\n }\n\n /**\n * Returns the currently active tabpanel if any.\n */\n get activeTabpanel(): HTMLElement | null {\n let activeTabpanelId = this.selectedTab?.getAttribute('aria-controls');\n return activeTabpanelId ? document.getElementById(activeTabpanelId) : null;\n }\n}\n"],"names":[],"version":3,"file":"tabs.module.js.map"}
|
package/dist/testSetup.main.js
CHANGED
|
@@ -39,35 +39,36 @@ $parcel$export(module.exports, "installPointerEvent", () => $b53408e40e8d56d0$ex
|
|
|
39
39
|
$parcel$global.MouseEvent = oldMouseEvent;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
function $b53408e40e8d56d0$export$93965c727ae9548a() {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
45
|
+
get pointerType() {
|
|
46
|
+
var _this__init_pointerType;
|
|
47
|
+
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
48
|
+
}
|
|
49
|
+
get pointerId() {
|
|
50
|
+
return this._init.pointerId;
|
|
51
|
+
}
|
|
52
|
+
get pageX() {
|
|
53
|
+
return this._init.pageX;
|
|
54
|
+
}
|
|
55
|
+
get pageY() {
|
|
56
|
+
return this._init.pageY;
|
|
57
|
+
}
|
|
58
|
+
get width() {
|
|
59
|
+
return this._init.width;
|
|
60
|
+
}
|
|
61
|
+
get height() {
|
|
62
|
+
return this._init.height;
|
|
63
|
+
}
|
|
64
|
+
constructor(name, init){
|
|
65
|
+
super(name, init);
|
|
66
|
+
this._init = init;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
42
70
|
function $b53408e40e8d56d0$export$82f0b04c1d69a901() {
|
|
43
|
-
beforeAll(
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
46
|
-
get pointerType() {
|
|
47
|
-
var _this__init_pointerType;
|
|
48
|
-
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
49
|
-
}
|
|
50
|
-
get pointerId() {
|
|
51
|
-
return this._init.pointerId;
|
|
52
|
-
}
|
|
53
|
-
get pageX() {
|
|
54
|
-
return this._init.pageX;
|
|
55
|
-
}
|
|
56
|
-
get pageY() {
|
|
57
|
-
return this._init.pageY;
|
|
58
|
-
}
|
|
59
|
-
get width() {
|
|
60
|
-
return this._init.width;
|
|
61
|
-
}
|
|
62
|
-
get height() {
|
|
63
|
-
return this._init.height;
|
|
64
|
-
}
|
|
65
|
-
constructor(name, init){
|
|
66
|
-
super(name, init);
|
|
67
|
-
this._init = init;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
+
beforeAll($b53408e40e8d56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B;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,SAAS;YACX,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM;QAC1B;QArBA,YAAY,IAAI,EAAE,IAAI,CAAE;YACtB,KAAK,CAAC,MAAM;YACZ,IAAI,CAAC,KAAK,GAAG;QACf;IAmBF;AACF;AAEO,SAAS;IACd,UAAU;IACV,SAAS;QACP,aAAa;QACb,OAAO,eAAO,YAAY;IAC5B;AACF","sources":["packages/@react-aria/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Enables reading pageX/pageY from fireEvent.mouse*(..., {pageX: ..., pageY: ...}).\n */\nexport function installMouseEvent(): void {\n let oldMouseEvent = MouseEvent;\n beforeAll(() => {\n global.MouseEvent = class FakeMouseEvent extends MouseEvent {\n _init: {pageX: number, pageY: number};\n constructor(name, init) {\n super(name, init);\n this._init = init;\n }\n get pageX() {\n return this._init.pageX;\n }\n get pageY() {\n return this._init.pageY;\n }\n };\n });\n afterAll(() => {\n global.MouseEvent = oldMouseEvent;\n });\n}\n\nexport function definePointerEvent(): void {\n // @ts-ignore\n global.PointerEvent = class FakePointerEvent extends MouseEvent {\n _init: {pageX: number, pageY: number, pointerType: string, pointerId: number, width: number, height: number};\n constructor(name, init) {\n super(name, init);\n this._init = init;\n }\n get pointerType() {\n return this._init.pointerType ?? 'mouse';\n }\n get pointerId() {\n return this._init.pointerId;\n }\n get pageX() {\n return this._init.pageX;\n }\n get pageY() {\n return this._init.pageY;\n }\n get width() {\n return this._init.width;\n }\n get height() {\n return this._init.height;\n }\n };\n}\n\nexport function installPointerEvent(): void {\n beforeAll(definePointerEvent);\n afterAll(() => {\n // @ts-ignore\n delete global.PointerEvent;\n });\n}\n"],"names":[],"version":3,"file":"testSetup.main.js.map"}
|
package/dist/testSetup.mjs
CHANGED
|
@@ -32,35 +32,36 @@
|
|
|
32
32
|
$parcel$global.MouseEvent = oldMouseEvent;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
function $68df97871cfb5e33$export$93965c727ae9548a() {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
38
|
+
get pointerType() {
|
|
39
|
+
var _this__init_pointerType;
|
|
40
|
+
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
41
|
+
}
|
|
42
|
+
get pointerId() {
|
|
43
|
+
return this._init.pointerId;
|
|
44
|
+
}
|
|
45
|
+
get pageX() {
|
|
46
|
+
return this._init.pageX;
|
|
47
|
+
}
|
|
48
|
+
get pageY() {
|
|
49
|
+
return this._init.pageY;
|
|
50
|
+
}
|
|
51
|
+
get width() {
|
|
52
|
+
return this._init.width;
|
|
53
|
+
}
|
|
54
|
+
get height() {
|
|
55
|
+
return this._init.height;
|
|
56
|
+
}
|
|
57
|
+
constructor(name, init){
|
|
58
|
+
super(name, init);
|
|
59
|
+
this._init = init;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
35
63
|
function $68df97871cfb5e33$export$82f0b04c1d69a901() {
|
|
36
|
-
beforeAll(
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
39
|
-
get pointerType() {
|
|
40
|
-
var _this__init_pointerType;
|
|
41
|
-
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
42
|
-
}
|
|
43
|
-
get pointerId() {
|
|
44
|
-
return this._init.pointerId;
|
|
45
|
-
}
|
|
46
|
-
get pageX() {
|
|
47
|
-
return this._init.pageX;
|
|
48
|
-
}
|
|
49
|
-
get pageY() {
|
|
50
|
-
return this._init.pageY;
|
|
51
|
-
}
|
|
52
|
-
get width() {
|
|
53
|
-
return this._init.width;
|
|
54
|
-
}
|
|
55
|
-
get height() {
|
|
56
|
-
return this._init.height;
|
|
57
|
-
}
|
|
58
|
-
constructor(name, init){
|
|
59
|
-
super(name, init);
|
|
60
|
-
this._init = init;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
+
beforeAll($68df97871cfb5e33$export$93965c727ae9548a);
|
|
64
65
|
afterAll(()=>{
|
|
65
66
|
// @ts-ignore
|
|
66
67
|
delete $parcel$global.PointerEvent;
|
|
@@ -68,5 +69,5 @@ function $68df97871cfb5e33$export$82f0b04c1d69a901() {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
|
|
71
|
-
export {$68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent};
|
|
72
|
+
export {$68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$93965c727ae9548a as definePointerEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent};
|
|
72
73
|
//# sourceMappingURL=testSetup.module.js.map
|
package/dist/testSetup.module.js
CHANGED
|
@@ -32,35 +32,36 @@
|
|
|
32
32
|
$parcel$global.MouseEvent = oldMouseEvent;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
function $68df97871cfb5e33$export$93965c727ae9548a() {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
38
|
+
get pointerType() {
|
|
39
|
+
var _this__init_pointerType;
|
|
40
|
+
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
41
|
+
}
|
|
42
|
+
get pointerId() {
|
|
43
|
+
return this._init.pointerId;
|
|
44
|
+
}
|
|
45
|
+
get pageX() {
|
|
46
|
+
return this._init.pageX;
|
|
47
|
+
}
|
|
48
|
+
get pageY() {
|
|
49
|
+
return this._init.pageY;
|
|
50
|
+
}
|
|
51
|
+
get width() {
|
|
52
|
+
return this._init.width;
|
|
53
|
+
}
|
|
54
|
+
get height() {
|
|
55
|
+
return this._init.height;
|
|
56
|
+
}
|
|
57
|
+
constructor(name, init){
|
|
58
|
+
super(name, init);
|
|
59
|
+
this._init = init;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
35
63
|
function $68df97871cfb5e33$export$82f0b04c1d69a901() {
|
|
36
|
-
beforeAll(
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
$parcel$global.PointerEvent = class FakePointerEvent extends MouseEvent {
|
|
39
|
-
get pointerType() {
|
|
40
|
-
var _this__init_pointerType;
|
|
41
|
-
return (_this__init_pointerType = this._init.pointerType) !== null && _this__init_pointerType !== void 0 ? _this__init_pointerType : 'mouse';
|
|
42
|
-
}
|
|
43
|
-
get pointerId() {
|
|
44
|
-
return this._init.pointerId;
|
|
45
|
-
}
|
|
46
|
-
get pageX() {
|
|
47
|
-
return this._init.pageX;
|
|
48
|
-
}
|
|
49
|
-
get pageY() {
|
|
50
|
-
return this._init.pageY;
|
|
51
|
-
}
|
|
52
|
-
get width() {
|
|
53
|
-
return this._init.width;
|
|
54
|
-
}
|
|
55
|
-
get height() {
|
|
56
|
-
return this._init.height;
|
|
57
|
-
}
|
|
58
|
-
constructor(name, init){
|
|
59
|
-
super(name, init);
|
|
60
|
-
this._init = init;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
+
beforeAll($68df97871cfb5e33$export$93965c727ae9548a);
|
|
64
65
|
afterAll(()=>{
|
|
65
66
|
// @ts-ignore
|
|
66
67
|
delete $parcel$global.PointerEvent;
|
|
@@ -68,5 +69,5 @@ function $68df97871cfb5e33$export$82f0b04c1d69a901() {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
|
|
71
|
-
export {$68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent};
|
|
72
|
+
export {$68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$93965c727ae9548a as definePointerEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent};
|
|
72
73
|
//# sourceMappingURL=testSetup.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED;;CAEC,GACM,SAAS;IACd,IAAI,gBAAgB;IACpB,UAAU;QACR,eAAO,UAAU,GAAG,MAAM,uBAAuB;YAM/C,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;YACzB;YACA,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;YACzB;YATA,YAAY,IAAI,EAAE,IAAI,CAAE;gBACtB,KAAK,CAAC,MAAM;gBACZ,IAAI,CAAC,KAAK,GAAG;YACf;QAOF;IACF;IACA,SAAS;QACP,eAAO,UAAU,GAAG;IACtB;AACF;AAEO,SAAS;IACd,
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED;;CAEC,GACM,SAAS;IACd,IAAI,gBAAgB;IACpB,UAAU;QACR,eAAO,UAAU,GAAG,MAAM,uBAAuB;YAM/C,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;YACzB;YACA,IAAI,QAAQ;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;YACzB;YATA,YAAY,IAAI,EAAE,IAAI,CAAE;gBACtB,KAAK,CAAC,MAAM;gBACZ,IAAI,CAAC,KAAK,GAAG;YACf;QAOF;IACF;IACA,SAAS;QACP,eAAO,UAAU,GAAG;IACtB;AACF;AAEO,SAAS;IACd,aAAa;IACb,eAAO,YAAY,GAAG,MAAM,yBAAyB;QAMnD,IAAI,cAAc;gBACT;YAAP,OAAO,CAAA,0BAAA,IAAI,CAAC,KAAK,CAAC,WAAW,cAAtB,qCAAA,0BAA0B;QACnC;QACA,IAAI,YAAY;YACd,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS;QAC7B;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,QAAQ;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;QACzB;QACA,IAAI,SAAS;YACX,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM;QAC1B;QArBA,YAAY,IAAI,EAAE,IAAI,CAAE;YACtB,KAAK,CAAC,MAAM;YACZ,IAAI,CAAC,KAAK,GAAG;QACf;IAmBF;AACF;AAEO,SAAS;IACd,UAAU;IACV,SAAS;QACP,aAAa;QACb,OAAO,eAAO,YAAY;IAC5B;AACF","sources":["packages/@react-aria/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Enables reading pageX/pageY from fireEvent.mouse*(..., {pageX: ..., pageY: ...}).\n */\nexport function installMouseEvent(): void {\n let oldMouseEvent = MouseEvent;\n beforeAll(() => {\n global.MouseEvent = class FakeMouseEvent extends MouseEvent {\n _init: {pageX: number, pageY: number};\n constructor(name, init) {\n super(name, init);\n this._init = init;\n }\n get pageX() {\n return this._init.pageX;\n }\n get pageY() {\n return this._init.pageY;\n }\n };\n });\n afterAll(() => {\n global.MouseEvent = oldMouseEvent;\n });\n}\n\nexport function definePointerEvent(): void {\n // @ts-ignore\n global.PointerEvent = class FakePointerEvent extends MouseEvent {\n _init: {pageX: number, pageY: number, pointerType: string, pointerId: number, width: number, height: number};\n constructor(name, init) {\n super(name, init);\n this._init = init;\n }\n get pointerType() {\n return this._init.pointerType ?? 'mouse';\n }\n get pointerId() {\n return this._init.pointerId;\n }\n get pageX() {\n return this._init.pageX;\n }\n get pageY() {\n return this._init.pageY;\n }\n get width() {\n return this._init.width;\n }\n get height() {\n return this._init.height;\n }\n };\n}\n\nexport function installPointerEvent(): void {\n beforeAll(definePointerEvent);\n afterAll(() => {\n // @ts-ignore\n delete global.PointerEvent;\n });\n}\n"],"names":[],"version":3,"file":"testSetup.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ interface BaseTesterOpts extends UserOpts {
|
|
|
19
19
|
/** The base element for the given tester (e.g. the table, menu trigger button, etc). */
|
|
20
20
|
root: HTMLElement;
|
|
21
21
|
}
|
|
22
|
+
interface CheckboxGroupTesterOpts extends BaseTesterOpts {
|
|
23
|
+
}
|
|
22
24
|
interface ComboBoxTesterOpts extends BaseTesterOpts {
|
|
23
25
|
/**
|
|
24
26
|
* The base element for the combobox. If provided the wrapping element around the target combobox (as is the the case with a ref provided to RSP ComboBox),
|
|
@@ -31,6 +33,16 @@ interface ComboBoxTesterOpts extends BaseTesterOpts {
|
|
|
31
33
|
*/
|
|
32
34
|
trigger?: HTMLElement;
|
|
33
35
|
}
|
|
36
|
+
interface DialogTesterOpts extends BaseTesterOpts {
|
|
37
|
+
/**
|
|
38
|
+
* The trigger element for the dialog.
|
|
39
|
+
*/
|
|
40
|
+
root: HTMLElement;
|
|
41
|
+
/**
|
|
42
|
+
* The overlay type of the dialog. Used to inform the tester how to find the dialog.
|
|
43
|
+
*/
|
|
44
|
+
overlayType?: 'modal' | 'popover';
|
|
45
|
+
}
|
|
34
46
|
interface GridListTesterOpts extends BaseTesterOpts {
|
|
35
47
|
}
|
|
36
48
|
interface ListBoxTesterOpts extends BaseTesterOpts {
|
|
@@ -53,6 +65,13 @@ interface MenuTesterOpts extends BaseTesterOpts {
|
|
|
53
65
|
*/
|
|
54
66
|
rootMenu?: HTMLElement;
|
|
55
67
|
}
|
|
68
|
+
interface RadioGroupTesterOpts extends BaseTesterOpts {
|
|
69
|
+
/**
|
|
70
|
+
* The horizontal layout direction, typically affected by locale.
|
|
71
|
+
* @default 'ltr'
|
|
72
|
+
*/
|
|
73
|
+
direction?: Direction;
|
|
74
|
+
}
|
|
56
75
|
interface SelectTesterOpts extends BaseTesterOpts {
|
|
57
76
|
/**
|
|
58
77
|
* The trigger element for the select. If provided the wrapping element around the target select (as is the case with a ref provided to RSP Select),
|
|
@@ -133,6 +152,45 @@ export function triggerLongPress(opts: {
|
|
|
133
152
|
export function installMouseEvent(): void;
|
|
134
153
|
export function installPointerEvent(): void;
|
|
135
154
|
export let pointerMap: pointerKey[];
|
|
155
|
+
interface TriggerCheckboxOptions {
|
|
156
|
+
/**
|
|
157
|
+
* What interaction type to use when triggering a checkbox. Defaults to the interaction type set on the tester.
|
|
158
|
+
*/
|
|
159
|
+
interactionType?: UserOpts['interactionType'];
|
|
160
|
+
/**
|
|
161
|
+
* The index, text, or node of the checkbox to toggle selection for.
|
|
162
|
+
*/
|
|
163
|
+
checkbox: number | string | HTMLElement;
|
|
164
|
+
}
|
|
165
|
+
export class CheckboxGroupTester {
|
|
166
|
+
constructor(opts: CheckboxGroupTesterOpts);
|
|
167
|
+
/**
|
|
168
|
+
* Set the interaction type used by the checkbox group tester.
|
|
169
|
+
*/
|
|
170
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
171
|
+
/**
|
|
172
|
+
* Returns a checkbox matching the specified index or text content.
|
|
173
|
+
*/
|
|
174
|
+
findCheckbox(opts: {
|
|
175
|
+
checkboxIndexOrText: number | string;
|
|
176
|
+
}): HTMLElement;
|
|
177
|
+
/**
|
|
178
|
+
* Toggles the specified checkbox. Defaults to using the interaction type set on the checkbox tester.
|
|
179
|
+
*/
|
|
180
|
+
toggleCheckbox(opts: TriggerCheckboxOptions): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Returns the checkboxgroup.
|
|
183
|
+
*/
|
|
184
|
+
get checkboxgroup(): HTMLElement;
|
|
185
|
+
/**
|
|
186
|
+
* Returns the checkboxes.
|
|
187
|
+
*/
|
|
188
|
+
get checkboxes(): HTMLElement[];
|
|
189
|
+
/**
|
|
190
|
+
* Returns the currently selected checkboxes in the checkboxgroup if any.
|
|
191
|
+
*/
|
|
192
|
+
get selectedCheckboxes(): HTMLElement[];
|
|
193
|
+
}
|
|
136
194
|
interface ComboBoxOpenOpts {
|
|
137
195
|
/**
|
|
138
196
|
* Whether the combobox opens on focus or needs to be manually opened via user action.
|
|
@@ -150,7 +208,7 @@ interface ComboBoxSelectOpts extends ComboBoxOpenOpts {
|
|
|
150
208
|
*/
|
|
151
209
|
option: number | string | HTMLElement;
|
|
152
210
|
}
|
|
153
|
-
|
|
211
|
+
export class ComboBoxTester {
|
|
154
212
|
constructor(opts: ComboBoxTesterOpts);
|
|
155
213
|
/**
|
|
156
214
|
* Set the interaction type used by the combobox tester.
|
|
@@ -202,11 +260,40 @@ declare class ComboBoxTester {
|
|
|
202
260
|
*/
|
|
203
261
|
get focusedOption(): HTMLElement | null;
|
|
204
262
|
}
|
|
263
|
+
interface DialogOpenOpts {
|
|
264
|
+
/**
|
|
265
|
+
* What interaction type to use when opening the dialog. Defaults to the interaction type set on the tester.
|
|
266
|
+
*/
|
|
267
|
+
interactionType?: UserOpts['interactionType'];
|
|
268
|
+
}
|
|
269
|
+
export class DialogTester {
|
|
270
|
+
constructor(opts: DialogTesterOpts);
|
|
271
|
+
/**
|
|
272
|
+
* Set the interaction type used by the dialog tester.
|
|
273
|
+
*/
|
|
274
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
275
|
+
/**
|
|
276
|
+
* Opens the dialog. Defaults to using the interaction type set on the dialog tester.
|
|
277
|
+
*/
|
|
278
|
+
open(opts?: DialogOpenOpts): Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Closes the dialog via the Escape key.
|
|
281
|
+
*/
|
|
282
|
+
close(): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Returns the dialog's trigger.
|
|
285
|
+
*/
|
|
286
|
+
get trigger(): HTMLElement;
|
|
287
|
+
/**
|
|
288
|
+
* Returns the dialog if present.
|
|
289
|
+
*/
|
|
290
|
+
get dialog(): HTMLElement | null;
|
|
291
|
+
}
|
|
205
292
|
interface GridListToggleRowOpts extends ToggleGridRowOpts {
|
|
206
293
|
}
|
|
207
294
|
interface GridListRowActionOpts extends GridRowActionOpts {
|
|
208
295
|
}
|
|
209
|
-
|
|
296
|
+
export class GridListTester {
|
|
210
297
|
constructor(opts: GridListTesterOpts);
|
|
211
298
|
/**
|
|
212
299
|
* Set the interaction type used by the gridlist tester.
|
|
@@ -280,7 +367,7 @@ interface ListBoxOptionActionOpts extends Omit<ListBoxToggleOptionOpts, 'keyboar
|
|
|
280
367
|
*/
|
|
281
368
|
needsDoubleClick?: boolean;
|
|
282
369
|
}
|
|
283
|
-
|
|
370
|
+
export class ListBoxTester {
|
|
284
371
|
constructor(opts: ListBoxTesterOpts);
|
|
285
372
|
/**
|
|
286
373
|
* Set the interaction type used by the listbox tester.
|
|
@@ -360,7 +447,7 @@ interface MenuOpenSubmenuOpts extends MenuOpenOpts {
|
|
|
360
447
|
*/
|
|
361
448
|
submenuTrigger: string | HTMLElement;
|
|
362
449
|
}
|
|
363
|
-
|
|
450
|
+
export class MenuTester {
|
|
364
451
|
constructor(opts: MenuTesterOpts);
|
|
365
452
|
/**
|
|
366
453
|
* Set the interaction type used by the menu tester.
|
|
@@ -412,6 +499,45 @@ declare class MenuTester {
|
|
|
412
499
|
*/
|
|
413
500
|
get submenuTriggers(): HTMLElement[];
|
|
414
501
|
}
|
|
502
|
+
interface TriggerRadioOptions {
|
|
503
|
+
/**
|
|
504
|
+
* What interaction type to use when triggering a radio. Defaults to the interaction type set on the tester.
|
|
505
|
+
*/
|
|
506
|
+
interactionType?: UserOpts['interactionType'];
|
|
507
|
+
/**
|
|
508
|
+
* The index, text, or node of the radio to toggle selection for.
|
|
509
|
+
*/
|
|
510
|
+
radio: number | string | HTMLElement;
|
|
511
|
+
}
|
|
512
|
+
export class RadioGroupTester {
|
|
513
|
+
constructor(opts: RadioGroupTesterOpts);
|
|
514
|
+
/**
|
|
515
|
+
* Set the interaction type used by the radio tester.
|
|
516
|
+
*/
|
|
517
|
+
setInteractionType(type: UserOpts['interactionType']): void;
|
|
518
|
+
/**
|
|
519
|
+
* Returns a radio matching the specified index or text content.
|
|
520
|
+
*/
|
|
521
|
+
findRadio(opts: {
|
|
522
|
+
radioIndexOrText: number | string;
|
|
523
|
+
}): HTMLElement;
|
|
524
|
+
/**
|
|
525
|
+
* Triggers the specified radio. Defaults to using the interaction type set on the radio tester.
|
|
526
|
+
*/
|
|
527
|
+
triggerRadio(opts: TriggerRadioOptions): Promise<void>;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the radiogroup.
|
|
530
|
+
*/
|
|
531
|
+
get radiogroup(): HTMLElement;
|
|
532
|
+
/**
|
|
533
|
+
* Returns the radios.
|
|
534
|
+
*/
|
|
535
|
+
get radios(): HTMLElement[];
|
|
536
|
+
/**
|
|
537
|
+
* Returns the currently selected radio in the radiogroup if any.
|
|
538
|
+
*/
|
|
539
|
+
get selectedRadio(): HTMLElement | null;
|
|
540
|
+
}
|
|
415
541
|
interface SelectOpenOpts {
|
|
416
542
|
/**
|
|
417
543
|
* What interaction type to use when opening the select. Defaults to the interaction type set on the tester.
|
|
@@ -424,7 +550,7 @@ interface SelectTriggerOptionOpts extends SelectOpenOpts {
|
|
|
424
550
|
*/
|
|
425
551
|
option: number | string | HTMLElement;
|
|
426
552
|
}
|
|
427
|
-
|
|
553
|
+
export class SelectTester {
|
|
428
554
|
constructor(opts: SelectTesterOpts);
|
|
429
555
|
/**
|
|
430
556
|
* Set the interaction type used by the select tester.
|
|
@@ -488,7 +614,7 @@ interface TableColumnHeaderActionOpts extends TableToggleSortOpts {
|
|
|
488
614
|
}
|
|
489
615
|
interface TableRowActionOpts extends GridRowActionOpts {
|
|
490
616
|
}
|
|
491
|
-
|
|
617
|
+
export class TableTester {
|
|
492
618
|
constructor(opts: TableTesterOpts);
|
|
493
619
|
/**
|
|
494
620
|
* Set the interaction type used by the table tester.
|
|
@@ -573,7 +699,7 @@ interface TriggerTabOptions {
|
|
|
573
699
|
*/
|
|
574
700
|
manualActivation?: boolean;
|
|
575
701
|
}
|
|
576
|
-
|
|
702
|
+
export class TabsTester {
|
|
577
703
|
constructor(opts: TabsTesterOpts);
|
|
578
704
|
/**
|
|
579
705
|
* Set the interaction type used by the tabs tester.
|
|
@@ -616,7 +742,7 @@ interface TreeToggleRowOpts extends ToggleGridRowOpts {
|
|
|
616
742
|
}
|
|
617
743
|
interface TreeRowActionOpts extends GridRowActionOpts {
|
|
618
744
|
}
|
|
619
|
-
|
|
745
|
+
export class TreeTester {
|
|
620
746
|
constructor(opts: TreeTesterOpts);
|
|
621
747
|
/**
|
|
622
748
|
* Set the interaction type used by the tree tester.
|
|
@@ -661,18 +787,21 @@ declare class TreeTester {
|
|
|
661
787
|
}): HTMLElement[];
|
|
662
788
|
}
|
|
663
789
|
declare let keyToUtil: {
|
|
664
|
-
'
|
|
665
|
-
'Table': typeof TableTester;
|
|
666
|
-
'Menu': typeof MenuTester;
|
|
790
|
+
'CheckboxGroup': typeof CheckboxGroupTester;
|
|
667
791
|
'ComboBox': typeof ComboBoxTester;
|
|
792
|
+
'Dialog': typeof DialogTester;
|
|
668
793
|
'GridList': typeof GridListTester;
|
|
669
794
|
'ListBox': typeof ListBoxTester;
|
|
795
|
+
'Menu': typeof MenuTester;
|
|
796
|
+
'RadioGroup': typeof RadioGroupTester;
|
|
797
|
+
'Select': typeof SelectTester;
|
|
798
|
+
'Table': typeof TableTester;
|
|
670
799
|
'Tabs': typeof TabsTester;
|
|
671
800
|
'Tree': typeof TreeTester;
|
|
672
801
|
};
|
|
673
802
|
type PatternNames = keyof typeof keyToUtil;
|
|
674
|
-
type Tester<T> = T extends 'ComboBox' ? ComboBoxTester : T extends 'GridList' ? GridListTester : T extends 'ListBox' ? ListBoxTester : T extends 'Menu' ? MenuTester : T extends 'Select' ? SelectTester : T extends 'Table' ? TableTester : T extends 'Tabs' ? TabsTester : T extends 'Tree' ? TreeTester : never;
|
|
675
|
-
type TesterOpts<T> = T extends 'ComboBox' ? ComboBoxTesterOpts : T extends 'GridList' ? GridListTesterOpts : T extends 'ListBox' ? ListBoxTesterOpts : T extends 'Menu' ? MenuTesterOpts : T extends 'Select' ? SelectTesterOpts : T extends 'Table' ? TableTesterOpts : T extends 'Tabs' ? TabsTesterOpts : T extends 'Tree' ? TreeTesterOpts : never;
|
|
803
|
+
type Tester<T> = T extends 'CheckboxGroup' ? CheckboxGroupTester : T extends 'ComboBox' ? ComboBoxTester : T extends 'Dialog' ? DialogTester : T extends 'GridList' ? GridListTester : T extends 'ListBox' ? ListBoxTester : T extends 'Menu' ? MenuTester : T extends 'RadioGroup' ? RadioGroupTester : T extends 'Select' ? SelectTester : T extends 'Table' ? TableTester : T extends 'Tabs' ? TabsTester : T extends 'Tree' ? TreeTester : never;
|
|
804
|
+
type TesterOpts<T> = T extends 'CheckboxGroup' ? CheckboxGroupTesterOpts : T extends 'ComboBox' ? ComboBoxTesterOpts : T extends 'Dialog' ? DialogTesterOpts : T extends 'GridList' ? GridListTesterOpts : T extends 'ListBox' ? ListBoxTesterOpts : T extends 'Menu' ? MenuTesterOpts : T extends 'RadioGroup' ? RadioGroupTesterOpts : T extends 'Select' ? SelectTesterOpts : T extends 'Table' ? TableTesterOpts : T extends 'Tabs' ? TabsTesterOpts : T extends 'Tree' ? TreeTesterOpts : never;
|
|
676
805
|
export class User {
|
|
677
806
|
/**
|
|
678
807
|
* The interaction type (mouse, touch, keyboard) that the test util user will use when interacting with a component. This can be overridden
|