@react-aria/test-utils 1.0.0-alpha.1 → 1.0.0-alpha.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.
Files changed (57) hide show
  1. package/dist/combobox.main.js +137 -0
  2. package/dist/combobox.main.js.map +1 -0
  3. package/dist/combobox.mjs +132 -0
  4. package/dist/combobox.module.js +132 -0
  5. package/dist/combobox.module.js.map +1 -0
  6. package/dist/events.main.js +25 -10
  7. package/dist/events.main.js.map +1 -1
  8. package/dist/events.mjs +25 -10
  9. package/dist/events.module.js +25 -10
  10. package/dist/events.module.js.map +1 -1
  11. package/dist/gridlist.main.js +97 -0
  12. package/dist/gridlist.main.js.map +1 -0
  13. package/dist/gridlist.mjs +92 -0
  14. package/dist/gridlist.module.js +92 -0
  15. package/dist/gridlist.module.js.map +1 -0
  16. package/dist/import.mjs +4 -2
  17. package/dist/main.js +10 -18
  18. package/dist/main.js.map +1 -1
  19. package/dist/menu.main.js +220 -0
  20. package/dist/menu.main.js.map +1 -0
  21. package/dist/menu.mjs +215 -0
  22. package/dist/menu.module.js +215 -0
  23. package/dist/menu.module.js.map +1 -0
  24. package/dist/module.js +4 -2
  25. package/dist/module.js.map +1 -1
  26. package/dist/select.main.js +113 -0
  27. package/dist/select.main.js.map +1 -0
  28. package/dist/select.mjs +108 -0
  29. package/dist/select.module.js +108 -0
  30. package/dist/select.module.js.map +1 -0
  31. package/dist/table.main.js +187 -0
  32. package/dist/table.main.js.map +1 -0
  33. package/dist/table.mjs +182 -0
  34. package/dist/table.module.js +182 -0
  35. package/dist/table.module.js.map +1 -0
  36. package/dist/testSetup.main.js +2 -6
  37. package/dist/testSetup.main.js.map +1 -1
  38. package/dist/testSetup.mjs +2 -6
  39. package/dist/testSetup.module.js +2 -6
  40. package/dist/testSetup.module.js.map +1 -1
  41. package/dist/types.d.ts +186 -4
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/user.main.js +65 -0
  44. package/dist/user.main.js.map +1 -0
  45. package/dist/user.mjs +56 -0
  46. package/dist/user.module.js +56 -0
  47. package/dist/user.module.js.map +1 -0
  48. package/package.json +5 -5
  49. package/src/combobox.ts +188 -0
  50. package/src/events.ts +28 -8
  51. package/src/gridlist.ts +116 -0
  52. package/src/index.ts +6 -3
  53. package/src/menu.ts +308 -0
  54. package/src/select.ts +158 -0
  55. package/src/table.ts +273 -0
  56. package/src/testSetup.ts +2 -6
  57. package/src/user.ts +73 -0
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUM,MAAM;IAkPX,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAChB,MAAM,IAAI,MAAM;QAElB,OAAO,IAAI,CAAC,QAAQ;IACtB;IAEA,IAAI,OAAO;QACT,IAAI,SAAS,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACvC,OAAO,SAAS,SAAS,cAAc,CAAC,UAAU;IACpD;IAEA,IAAI,UAAyB;QAC3B,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,UAAyB,EAAE;QAC/B,IAAI,MAAM;YACR,UAAU,CAAA,GAAA,iCAAK,EAAE,MAAM,cAAc,CAAC;YACtC,IAAI,QAAQ,MAAM,KAAK,GAAG;gBACxB,UAAU,CAAA,GAAA,iCAAK,EAAE,MAAM,cAAc,CAAC;gBACtC,IAAI,QAAQ,MAAM,KAAK,GACrB,UAAU,CAAA,GAAA,iCAAK,EAAE,MAAM,cAAc,CAAC;YAE1C;QACF;QAEA,OAAO;IACT;IAEA,IAAI,WAAW;QACb,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,MACF,OAAO,CAAA,GAAA,iCAAK,EAAE,MAAM,cAAc,CAAC;aAEnC,OAAO,EAAE;IAEb;IAEA,IAAI,kBAAkB;QACpB,IAAI,UAAU,IAAI,CAAC,OAAO;QAC1B,IAAI,QAAQ,MAAM,GAAG,GACnB,OAAO,IAAI,CAAC,OAAO,CA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I,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAEzB,MAAM,CAAA,GAAA,kCAAM,EAAE;oBACZ,IAAI,SAAS,aAAa,KAAK,IAAI,CAAC,OAAO,EACzC,MAAM,IAAI,MAAM,CAAC,0FAA0F,EAAE,SAAS,aAAa,EAAE;yBAErI,OAAO;gBAEX;gBAEA,IAAI,SAAS,QAAQ,CAAC,OACpB,MAAM,IAAI,MAAM;YAEpB;QACF;QAxOE,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,aAAE,SAAS,EAAC,GAAG;QAC7D,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QAErB,gEAAgE;QAChE,IAAI,KAAK,YAAY,CAAC,YAAY,YAChC,IAAI,CAAC,QAAQ,GAAG;aACX;YACL,wEAAwE;YACxE,IAAI,UAAU,CAAA,GAAA,iCAAK,EAAE,MAAM,WAAW,CAAC;YACvC,IAAI,SACF,IAAI,CAAC,QAAQ,GAAG;iBAEhB,IAAI,CAAC,QAAQ,GAAG;QAEpB;QAEA,IAAI,CAAC,UAAU,GAAG,aAAa;IACjC;AAoQF","sources":["packages/@react-aria/test-utils/src/menu.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, waitFor, within} from '@testing-library/react';\nimport {BaseTesterOpts, UserOpts} from './user';\nimport {triggerLongPress} from './events';\n\nexport interface MenuOptions extends UserOpts, BaseTesterOpts {\n user?: any,\n isSubmenu?: boolean\n}\nexport class MenuTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _trigger: HTMLElement | undefined;\n private _isSubmenu: boolean = false;\n\n constructor(opts: MenuOptions) {\n let {root, user, interactionType, advanceTimer, isSubmenu} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n\n // Handle case where a submenu trigger is provided to the tester\n if (root.getAttribute('role') === 'menuitem') {\n this._trigger = root;\n } else {\n // Handle case where element provided is a wrapper of the trigger button\n let trigger = within(root).queryByRole('button');\n if (trigger) {\n this._trigger = trigger;\n } else {\n this._trigger = root;\n }\n }\n\n this._isSubmenu = isSubmenu || false;\n }\n\n setInteractionType = (type: UserOpts['interactionType']) => {\n this._interactionType = type;\n };\n\n // TODO: this has been common to select as well, maybe make select use it? Or make a generic method. Will need to make error messages generic\n // One difference will be that it supports long press as well\n open = async (opts: {needsLongPress?: boolean, interactionType?: UserOpts['interactionType'], direction?: 'up' | 'down'} = {}) => {\n let {\n needsLongPress,\n interactionType = this._interactionType,\n direction\n } = opts;\n let trigger = this.trigger;\n let isDisabled = trigger.hasAttribute('disabled');\n if (interactionType === 'mouse' || interactionType === 'touch') {\n if (needsLongPress) {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n let pointerType = interactionType === 'mouse' ? 'mouse' : 'touch';\n await triggerLongPress({element: trigger, advanceTimer: this._advanceTimer, pointerOpts: {pointerType}});\n } else if (interactionType === 'mouse') {\n await this.user.click(trigger);\n } else {\n await this.user.pointer({target: trigger, keys: '[TouchA]'});\n }\n } else if (interactionType === 'keyboard' && !isDisabled) {\n if (direction === 'up') {\n act(() => trigger.focus());\n await this.user.keyboard('[ArrowUp]');\n } else if (direction === 'down') {\n act(() => trigger.focus());\n await this.user.keyboard('[ArrowDown]');\n } else {\n act(() => trigger.focus());\n await this.user.keyboard('[Enter]');\n }\n }\n\n await waitFor(() => {\n if (trigger.getAttribute('aria-controls') == null && !isDisabled) {\n throw new Error('No aria-controls found on menu trigger element.');\n } else {\n return true;\n }\n });\n if (!isDisabled) {\n let menuId = trigger.getAttribute('aria-controls');\n await waitFor(() => {\n if (!menuId || document.getElementById(menuId) == null) {\n throw new Error(`Menu with id of ${menuId} not found in document.`);\n } else {\n return true;\n }\n });\n }\n };\n\n // TODO: also very similar to select, barring potential long press support\n // Close on select is also kinda specific?\n selectOption = async (opts: {\n option?: HTMLElement,\n optionText?: string,\n menuSelectionMode?: 'single' | 'multiple',\n needsLongPress?: boolean,\n closesOnSelect?: boolean,\n interactionType?: UserOpts['interactionType'],\n keyboardActivation?: 'Space' | 'Enter'\n }) => {\n let {\n optionText,\n menuSelectionMode = 'single',\n needsLongPress,\n closesOnSelect = true,\n option,\n interactionType = this._interactionType,\n keyboardActivation = 'Enter'\n } = opts;\n let trigger = this.trigger;\n\n if (!trigger.getAttribute('aria-controls') && !trigger.hasAttribute('aria-expanded')) {\n await this.open({needsLongPress});\n }\n\n let menu = this.menu;\n if (menu) {\n if (!option && optionText) {\n option = (within(menu!).getByText(optionText).closest('[role=menuitem], [role=menuitemradio], [role=menuitemcheckbox]'))! as HTMLElement;\n }\n if (!option) {\n throw new Error('No option found in the menu.');\n }\n\n if (interactionType === 'keyboard') {\n if (document.activeElement !== menu || !menu.contains(document.activeElement)) {\n act(() => menu.focus());\n }\n\n await this.keyboardNavigateToOption({option});\n await this.user.keyboard(`[${keyboardActivation}]`);\n } else {\n if (interactionType === 'mouse') {\n await this.user.click(option);\n } else {\n await this.user.pointer({target: option, keys: '[TouchA]'});\n }\n }\n act(() => {jest.runAllTimers();});\n\n if (option && option.getAttribute('href') == null && option.getAttribute('aria-haspopup') == null && menuSelectionMode === 'single' && closesOnSelect && keyboardActivation !== 'Space' && !this._isSubmenu) {\n await waitFor(() => {\n if (document.activeElement !== trigger) {\n throw new Error(`Expected the document.activeElement after selecting an option to be the menu trigger but got ${document.activeElement}`);\n } else {\n return true;\n }\n });\n\n if (document.contains(menu)) {\n throw new Error('Expected menu element to not be in the document after selecting an option');\n }\n }\n } else {\n throw new Error(\"Attempted to select a option in the menu, but menu wasn't found.\");\n }\n };\n\n // TODO: update this to remove needsLongPress if we wanna make the user call open first always\n openSubmenu = async (opts: {submenuTrigger?: HTMLElement, submenuTriggerText?: string, needsLongPress?: boolean, interactionType?: UserOpts['interactionType']}): Promise<MenuTester | null> => {\n let {\n submenuTrigger,\n submenuTriggerText,\n needsLongPress,\n interactionType = this._interactionType\n } = opts;\n\n let trigger = this.trigger;\n let isDisabled = trigger.hasAttribute('disabled');\n if (!trigger.getAttribute('aria-controls') && !isDisabled) {\n await this.open({needsLongPress});\n }\n if (!isDisabled) {\n let menu = this.menu;\n if (menu) {\n let submenu;\n if (submenuTrigger) {\n submenu = submenuTrigger;\n } else if (submenuTriggerText) {\n submenu = within(menu).getByText(submenuTriggerText);\n }\n\n let submenuTriggerTester = new MenuTester({user: this.user, interactionType: this._interactionType, root: submenu, isSubmenu: true});\n if (interactionType === 'mouse') {\n await this.user.pointer({target: submenu});\n act(() => {jest.runAllTimers();});\n } else if (interactionType === 'keyboard') {\n await this.keyboardNavigateToOption({option: submenu});\n await this.user.keyboard('[ArrowRight]');\n act(() => {jest.runAllTimers();});\n } else {\n await submenuTriggerTester.open();\n }\n\n\n return submenuTriggerTester;\n }\n }\n\n return null;\n };\n\n keyboardNavigateToOption = async (opts: {option: HTMLElement}) => {\n let {option} = opts;\n let options = this.options;\n let targetIndex = options.indexOf(option);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the menu');\n }\n if (document.activeElement === this.menu) {\n await this.user.keyboard('[ArrowDown]');\n }\n let currIndex = options.indexOf(document.activeElement as HTMLElement);\n if (targetIndex === -1) {\n throw new Error('ActiveElement is not in the menu');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n\n close = async () => {\n let menu = this.menu;\n if (menu) {\n act(() => menu.focus());\n await this.user.keyboard('[Escape]');\n\n await waitFor(() => {\n if (document.activeElement !== this.trigger) {\n throw new Error(`Expected the document.activeElement after closing the menu to be the menu trigger but got ${document.activeElement}`);\n } else {\n return true;\n }\n });\n\n if (document.contains(menu)) {\n throw new Error('Expected the menu to not be in the document after closing it.');\n }\n }\n };\n\n get trigger() {\n if (!this._trigger) {\n throw new Error('No trigger element found for menu.');\n }\n return this._trigger;\n }\n\n get menu() {\n let menuId = this.trigger.getAttribute('aria-controls');\n return menuId ? document.getElementById(menuId) : undefined;\n }\n\n get options(): HTMLElement[] {\n let menu = this.menu;\n let options: HTMLElement[] = [];\n if (menu) {\n options = within(menu).queryAllByRole('menuitem');\n if (options.length === 0) {\n options = within(menu).queryAllByRole('menuitemradio');\n if (options.length === 0) {\n options = within(menu).queryAllByRole('menuitemcheckbox');\n }\n }\n }\n\n return options;\n }\n\n get sections() {\n let menu = this.menu;\n if (menu) {\n return within(menu).queryAllByRole('group');\n } else {\n return [];\n }\n }\n\n get submenuTriggers() {\n let options = this.options;\n if (options.length > 0) {\n return this.options.filter(item => item.getAttribute('aria-haspopup') != null);\n }\n\n return [];\n }\n}\n"],"names":[],"version":3,"file":"menu.main.js.map"}
package/dist/menu.mjs ADDED
@@ -0,0 +1,215 @@
1
+ import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.mjs";
2
+ import {within as $gS6KO$within, act as $gS6KO$act, waitFor as $gS6KO$waitFor} from "@testing-library/react";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ class $74b93f0617179929$export$f73bbc9212ed861e {
17
+ get trigger() {
18
+ if (!this._trigger) throw new Error('No trigger element found for menu.');
19
+ return this._trigger;
20
+ }
21
+ get menu() {
22
+ let menuId = this.trigger.getAttribute('aria-controls');
23
+ return menuId ? document.getElementById(menuId) : undefined;
24
+ }
25
+ get options() {
26
+ let menu = this.menu;
27
+ let options = [];
28
+ if (menu) {
29
+ options = (0, $gS6KO$within)(menu).queryAllByRole('menuitem');
30
+ if (options.length === 0) {
31
+ options = (0, $gS6KO$within)(menu).queryAllByRole('menuitemradio');
32
+ if (options.length === 0) options = (0, $gS6KO$within)(menu).queryAllByRole('menuitemcheckbox');
33
+ }
34
+ }
35
+ return options;
36
+ }
37
+ get sections() {
38
+ let menu = this.menu;
39
+ if (menu) return (0, $gS6KO$within)(menu).queryAllByRole('group');
40
+ else return [];
41
+ }
42
+ get submenuTriggers() {
43
+ let options = this.options;
44
+ if (options.length > 0) return this.options.filter((item)=>item.getAttribute('aria-haspopup') != null);
45
+ return [];
46
+ }
47
+ constructor(opts){
48
+ this._isSubmenu = false;
49
+ this.setInteractionType = (type)=>{
50
+ this._interactionType = type;
51
+ };
52
+ // TODO: this has been common to select as well, maybe make select use it? Or make a generic method. Will need to make error messages generic
53
+ // One difference will be that it supports long press as well
54
+ this.open = async (opts = {})=>{
55
+ let { needsLongPress: needsLongPress, interactionType: interactionType = this._interactionType, direction: direction } = opts;
56
+ let trigger = this.trigger;
57
+ let isDisabled = trigger.hasAttribute('disabled');
58
+ if (interactionType === 'mouse' || interactionType === 'touch') {
59
+ if (needsLongPress) {
60
+ if (this._advanceTimer == null) throw new Error('No advanceTimers provided for long press.');
61
+ let pointerType = interactionType === 'mouse' ? 'mouse' : 'touch';
62
+ await (0, $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b)({
63
+ element: trigger,
64
+ advanceTimer: this._advanceTimer,
65
+ pointerOpts: {
66
+ pointerType: pointerType
67
+ }
68
+ });
69
+ } else if (interactionType === 'mouse') await this.user.click(trigger);
70
+ else await this.user.pointer({
71
+ target: trigger,
72
+ keys: '[TouchA]'
73
+ });
74
+ } else if (interactionType === 'keyboard' && !isDisabled) {
75
+ if (direction === 'up') {
76
+ (0, $gS6KO$act)(()=>trigger.focus());
77
+ await this.user.keyboard('[ArrowUp]');
78
+ } else if (direction === 'down') {
79
+ (0, $gS6KO$act)(()=>trigger.focus());
80
+ await this.user.keyboard('[ArrowDown]');
81
+ } else {
82
+ (0, $gS6KO$act)(()=>trigger.focus());
83
+ await this.user.keyboard('[Enter]');
84
+ }
85
+ }
86
+ await (0, $gS6KO$waitFor)(()=>{
87
+ if (trigger.getAttribute('aria-controls') == null && !isDisabled) throw new Error('No aria-controls found on menu trigger element.');
88
+ else return true;
89
+ });
90
+ if (!isDisabled) {
91
+ let menuId = trigger.getAttribute('aria-controls');
92
+ await (0, $gS6KO$waitFor)(()=>{
93
+ if (!menuId || document.getElementById(menuId) == null) throw new Error(`Menu with id of ${menuId} not found in document.`);
94
+ else return true;
95
+ });
96
+ }
97
+ };
98
+ // TODO: also very similar to select, barring potential long press support
99
+ // Close on select is also kinda specific?
100
+ this.selectOption = async (opts)=>{
101
+ let { optionText: optionText, menuSelectionMode: menuSelectionMode = 'single', needsLongPress: needsLongPress, closesOnSelect: closesOnSelect = true, option: option, interactionType: interactionType = this._interactionType, keyboardActivation: keyboardActivation = 'Enter' } = opts;
102
+ let trigger = this.trigger;
103
+ if (!trigger.getAttribute('aria-controls') && !trigger.hasAttribute('aria-expanded')) await this.open({
104
+ needsLongPress: needsLongPress
105
+ });
106
+ let menu = this.menu;
107
+ if (menu) {
108
+ if (!option && optionText) option = (0, $gS6KO$within)(menu).getByText(optionText).closest('[role=menuitem], [role=menuitemradio], [role=menuitemcheckbox]');
109
+ if (!option) throw new Error('No option found in the menu.');
110
+ if (interactionType === 'keyboard') {
111
+ if (document.activeElement !== menu || !menu.contains(document.activeElement)) (0, $gS6KO$act)(()=>menu.focus());
112
+ await this.keyboardNavigateToOption({
113
+ option: option
114
+ });
115
+ await this.user.keyboard(`[${keyboardActivation}]`);
116
+ } else if (interactionType === 'mouse') await this.user.click(option);
117
+ else await this.user.pointer({
118
+ target: option,
119
+ keys: '[TouchA]'
120
+ });
121
+ (0, $gS6KO$act)(()=>{
122
+ jest.runAllTimers();
123
+ });
124
+ if (option && option.getAttribute('href') == null && option.getAttribute('aria-haspopup') == null && menuSelectionMode === 'single' && closesOnSelect && keyboardActivation !== 'Space' && !this._isSubmenu) {
125
+ await (0, $gS6KO$waitFor)(()=>{
126
+ if (document.activeElement !== trigger) throw new Error(`Expected the document.activeElement after selecting an option to be the menu trigger but got ${document.activeElement}`);
127
+ else return true;
128
+ });
129
+ if (document.contains(menu)) throw new Error('Expected menu element to not be in the document after selecting an option');
130
+ }
131
+ } else throw new Error("Attempted to select a option in the menu, but menu wasn't found.");
132
+ };
133
+ // TODO: update this to remove needsLongPress if we wanna make the user call open first always
134
+ this.openSubmenu = async (opts)=>{
135
+ let { submenuTrigger: submenuTrigger, submenuTriggerText: submenuTriggerText, needsLongPress: needsLongPress, interactionType: interactionType = this._interactionType } = opts;
136
+ let trigger = this.trigger;
137
+ let isDisabled = trigger.hasAttribute('disabled');
138
+ if (!trigger.getAttribute('aria-controls') && !isDisabled) await this.open({
139
+ needsLongPress: needsLongPress
140
+ });
141
+ if (!isDisabled) {
142
+ let menu = this.menu;
143
+ if (menu) {
144
+ let submenu;
145
+ if (submenuTrigger) submenu = submenuTrigger;
146
+ else if (submenuTriggerText) submenu = (0, $gS6KO$within)(menu).getByText(submenuTriggerText);
147
+ let submenuTriggerTester = new $74b93f0617179929$export$f73bbc9212ed861e({
148
+ user: this.user,
149
+ interactionType: this._interactionType,
150
+ root: submenu,
151
+ isSubmenu: true
152
+ });
153
+ if (interactionType === 'mouse') {
154
+ await this.user.pointer({
155
+ target: submenu
156
+ });
157
+ (0, $gS6KO$act)(()=>{
158
+ jest.runAllTimers();
159
+ });
160
+ } else if (interactionType === 'keyboard') {
161
+ await this.keyboardNavigateToOption({
162
+ option: submenu
163
+ });
164
+ await this.user.keyboard('[ArrowRight]');
165
+ (0, $gS6KO$act)(()=>{
166
+ jest.runAllTimers();
167
+ });
168
+ } else await submenuTriggerTester.open();
169
+ return submenuTriggerTester;
170
+ }
171
+ }
172
+ return null;
173
+ };
174
+ this.keyboardNavigateToOption = async (opts)=>{
175
+ let { option: option } = opts;
176
+ let options = this.options;
177
+ let targetIndex = options.indexOf(option);
178
+ if (targetIndex === -1) throw new Error('Option provided is not in the menu');
179
+ if (document.activeElement === this.menu) await this.user.keyboard('[ArrowDown]');
180
+ let currIndex = options.indexOf(document.activeElement);
181
+ if (targetIndex === -1) throw new Error('ActiveElement is not in the menu');
182
+ let direction = targetIndex > currIndex ? 'down' : 'up';
183
+ for(let i = 0; i < Math.abs(targetIndex - currIndex); i++)await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);
184
+ };
185
+ this.close = async ()=>{
186
+ let menu = this.menu;
187
+ if (menu) {
188
+ (0, $gS6KO$act)(()=>menu.focus());
189
+ await this.user.keyboard('[Escape]');
190
+ await (0, $gS6KO$waitFor)(()=>{
191
+ if (document.activeElement !== this.trigger) throw new Error(`Expected the document.activeElement after closing the menu to be the menu trigger but got ${document.activeElement}`);
192
+ else return true;
193
+ });
194
+ if (document.contains(menu)) throw new Error('Expected the menu to not be in the document after closing it.');
195
+ }
196
+ };
197
+ let { root: root, user: user, interactionType: interactionType, advanceTimer: advanceTimer, isSubmenu: isSubmenu } = opts;
198
+ this.user = user;
199
+ this._interactionType = interactionType || 'mouse';
200
+ this._advanceTimer = advanceTimer;
201
+ // Handle case where a submenu trigger is provided to the tester
202
+ if (root.getAttribute('role') === 'menuitem') this._trigger = root;
203
+ else {
204
+ // Handle case where element provided is a wrapper of the trigger button
205
+ let trigger = (0, $gS6KO$within)(root).queryByRole('button');
206
+ if (trigger) this._trigger = trigger;
207
+ else this._trigger = root;
208
+ }
209
+ this._isSubmenu = isSubmenu || false;
210
+ }
211
+ }
212
+
213
+
214
+ export {$74b93f0617179929$export$f73bbc9212ed861e as MenuTester};
215
+ //# sourceMappingURL=menu.module.js.map
@@ -0,0 +1,215 @@
1
+ import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.module.js";
2
+ import {within as $gS6KO$within, act as $gS6KO$act, waitFor as $gS6KO$waitFor} from "@testing-library/react";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ class $74b93f0617179929$export$f73bbc9212ed861e {
17
+ get trigger() {
18
+ if (!this._trigger) throw new Error('No trigger element found for menu.');
19
+ return this._trigger;
20
+ }
21
+ get menu() {
22
+ let menuId = this.trigger.getAttribute('aria-controls');
23
+ return menuId ? document.getElementById(menuId) : undefined;
24
+ }
25
+ get options() {
26
+ let menu = this.menu;
27
+ let options = [];
28
+ if (menu) {
29
+ options = (0, $gS6KO$within)(menu).queryAllByRole('menuitem');
30
+ if (options.length === 0) {
31
+ options = (0, $gS6KO$within)(menu).queryAllByRole('menuitemradio');
32
+ if (options.length === 0) options = (0, $gS6KO$within)(menu).queryAllByRole('menuitemcheckbox');
33
+ }
34
+ }
35
+ return options;
36
+ }
37
+ get sections() {
38
+ let menu = this.menu;
39
+ if (menu) return (0, $gS6KO$within)(menu).queryAllByRole('group');
40
+ else return [];
41
+ }
42
+ get submenuTriggers() {
43
+ let options = this.options;
44
+ if (options.length > 0) return this.options.filter((item)=>item.getAttribute('aria-haspopup') != null);
45
+ return [];
46
+ }
47
+ constructor(opts){
48
+ this._isSubmenu = false;
49
+ this.setInteractionType = (type)=>{
50
+ this._interactionType = type;
51
+ };
52
+ // TODO: this has been common to select as well, maybe make select use it? Or make a generic method. Will need to make error messages generic
53
+ // One difference will be that it supports long press as well
54
+ this.open = async (opts = {})=>{
55
+ let { needsLongPress: needsLongPress, interactionType: interactionType = this._interactionType, direction: direction } = opts;
56
+ let trigger = this.trigger;
57
+ let isDisabled = trigger.hasAttribute('disabled');
58
+ if (interactionType === 'mouse' || interactionType === 'touch') {
59
+ if (needsLongPress) {
60
+ if (this._advanceTimer == null) throw new Error('No advanceTimers provided for long press.');
61
+ let pointerType = interactionType === 'mouse' ? 'mouse' : 'touch';
62
+ await (0, $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b)({
63
+ element: trigger,
64
+ advanceTimer: this._advanceTimer,
65
+ pointerOpts: {
66
+ pointerType: pointerType
67
+ }
68
+ });
69
+ } else if (interactionType === 'mouse') await this.user.click(trigger);
70
+ else await this.user.pointer({
71
+ target: trigger,
72
+ keys: '[TouchA]'
73
+ });
74
+ } else if (interactionType === 'keyboard' && !isDisabled) {
75
+ if (direction === 'up') {
76
+ (0, $gS6KO$act)(()=>trigger.focus());
77
+ await this.user.keyboard('[ArrowUp]');
78
+ } else if (direction === 'down') {
79
+ (0, $gS6KO$act)(()=>trigger.focus());
80
+ await this.user.keyboard('[ArrowDown]');
81
+ } else {
82
+ (0, $gS6KO$act)(()=>trigger.focus());
83
+ await this.user.keyboard('[Enter]');
84
+ }
85
+ }
86
+ await (0, $gS6KO$waitFor)(()=>{
87
+ if (trigger.getAttribute('aria-controls') == null && !isDisabled) throw new Error('No aria-controls found on menu trigger element.');
88
+ else return true;
89
+ });
90
+ if (!isDisabled) {
91
+ let menuId = trigger.getAttribute('aria-controls');
92
+ await (0, $gS6KO$waitFor)(()=>{
93
+ if (!menuId || document.getElementById(menuId) == null) throw new Error(`Menu with id of ${menuId} not found in document.`);
94
+ else return true;
95
+ });
96
+ }
97
+ };
98
+ // TODO: also very similar to select, barring potential long press support
99
+ // Close on select is also kinda specific?
100
+ this.selectOption = async (opts)=>{
101
+ let { optionText: optionText, menuSelectionMode: menuSelectionMode = 'single', needsLongPress: needsLongPress, closesOnSelect: closesOnSelect = true, option: option, interactionType: interactionType = this._interactionType, keyboardActivation: keyboardActivation = 'Enter' } = opts;
102
+ let trigger = this.trigger;
103
+ if (!trigger.getAttribute('aria-controls') && !trigger.hasAttribute('aria-expanded')) await this.open({
104
+ needsLongPress: needsLongPress
105
+ });
106
+ let menu = this.menu;
107
+ if (menu) {
108
+ if (!option && optionText) option = (0, $gS6KO$within)(menu).getByText(optionText).closest('[role=menuitem], [role=menuitemradio], [role=menuitemcheckbox]');
109
+ if (!option) throw new Error('No option found in the menu.');
110
+ if (interactionType === 'keyboard') {
111
+ if (document.activeElement !== menu || !menu.contains(document.activeElement)) (0, $gS6KO$act)(()=>menu.focus());
112
+ await this.keyboardNavigateToOption({
113
+ option: option
114
+ });
115
+ await this.user.keyboard(`[${keyboardActivation}]`);
116
+ } else if (interactionType === 'mouse') await this.user.click(option);
117
+ else await this.user.pointer({
118
+ target: option,
119
+ keys: '[TouchA]'
120
+ });
121
+ (0, $gS6KO$act)(()=>{
122
+ jest.runAllTimers();
123
+ });
124
+ if (option && option.getAttribute('href') == null && option.getAttribute('aria-haspopup') == null && menuSelectionMode === 'single' && closesOnSelect && keyboardActivation !== 'Space' && !this._isSubmenu) {
125
+ await (0, $gS6KO$waitFor)(()=>{
126
+ if (document.activeElement !== trigger) throw new Error(`Expected the document.activeElement after selecting an option to be the menu trigger but got ${document.activeElement}`);
127
+ else return true;
128
+ });
129
+ if (document.contains(menu)) throw new Error('Expected menu element to not be in the document after selecting an option');
130
+ }
131
+ } else throw new Error("Attempted to select a option in the menu, but menu wasn't found.");
132
+ };
133
+ // TODO: update this to remove needsLongPress if we wanna make the user call open first always
134
+ this.openSubmenu = async (opts)=>{
135
+ let { submenuTrigger: submenuTrigger, submenuTriggerText: submenuTriggerText, needsLongPress: needsLongPress, interactionType: interactionType = this._interactionType } = opts;
136
+ let trigger = this.trigger;
137
+ let isDisabled = trigger.hasAttribute('disabled');
138
+ if (!trigger.getAttribute('aria-controls') && !isDisabled) await this.open({
139
+ needsLongPress: needsLongPress
140
+ });
141
+ if (!isDisabled) {
142
+ let menu = this.menu;
143
+ if (menu) {
144
+ let submenu;
145
+ if (submenuTrigger) submenu = submenuTrigger;
146
+ else if (submenuTriggerText) submenu = (0, $gS6KO$within)(menu).getByText(submenuTriggerText);
147
+ let submenuTriggerTester = new $74b93f0617179929$export$f73bbc9212ed861e({
148
+ user: this.user,
149
+ interactionType: this._interactionType,
150
+ root: submenu,
151
+ isSubmenu: true
152
+ });
153
+ if (interactionType === 'mouse') {
154
+ await this.user.pointer({
155
+ target: submenu
156
+ });
157
+ (0, $gS6KO$act)(()=>{
158
+ jest.runAllTimers();
159
+ });
160
+ } else if (interactionType === 'keyboard') {
161
+ await this.keyboardNavigateToOption({
162
+ option: submenu
163
+ });
164
+ await this.user.keyboard('[ArrowRight]');
165
+ (0, $gS6KO$act)(()=>{
166
+ jest.runAllTimers();
167
+ });
168
+ } else await submenuTriggerTester.open();
169
+ return submenuTriggerTester;
170
+ }
171
+ }
172
+ return null;
173
+ };
174
+ this.keyboardNavigateToOption = async (opts)=>{
175
+ let { option: option } = opts;
176
+ let options = this.options;
177
+ let targetIndex = options.indexOf(option);
178
+ if (targetIndex === -1) throw new Error('Option provided is not in the menu');
179
+ if (document.activeElement === this.menu) await this.user.keyboard('[ArrowDown]');
180
+ let currIndex = options.indexOf(document.activeElement);
181
+ if (targetIndex === -1) throw new Error('ActiveElement is not in the menu');
182
+ let direction = targetIndex > currIndex ? 'down' : 'up';
183
+ for(let i = 0; i < Math.abs(targetIndex - currIndex); i++)await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);
184
+ };
185
+ this.close = async ()=>{
186
+ let menu = this.menu;
187
+ if (menu) {
188
+ (0, $gS6KO$act)(()=>menu.focus());
189
+ await this.user.keyboard('[Escape]');
190
+ await (0, $gS6KO$waitFor)(()=>{
191
+ if (document.activeElement !== this.trigger) throw new Error(`Expected the document.activeElement after closing the menu to be the menu trigger but got ${document.activeElement}`);
192
+ else return true;
193
+ });
194
+ if (document.contains(menu)) throw new Error('Expected the menu to not be in the document after closing it.');
195
+ }
196
+ };
197
+ let { root: root, user: user, interactionType: interactionType, advanceTimer: advanceTimer, isSubmenu: isSubmenu } = opts;
198
+ this.user = user;
199
+ this._interactionType = interactionType || 'mouse';
200
+ this._advanceTimer = advanceTimer;
201
+ // Handle case where a submenu trigger is provided to the tester
202
+ if (root.getAttribute('role') === 'menuitem') this._trigger = root;
203
+ else {
204
+ // Handle case where element provided is a wrapper of the trigger button
205
+ let trigger = (0, $gS6KO$within)(root).queryByRole('button');
206
+ if (trigger) this._trigger = trigger;
207
+ else this._trigger = root;
208
+ }
209
+ this._isSubmenu = isSubmenu || false;
210
+ }
211
+ }
212
+
213
+
214
+ export {$74b93f0617179929$export$f73bbc9212ed861e as MenuTester};
215
+ //# sourceMappingURL=menu.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUM,MAAM;IAkPX,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAChB,MAAM,IAAI,MAAM;QAElB,OAAO,IAAI,CAAC,QAAQ;IACtB;IAEA,IAAI,OAAO;QACT,IAAI,SAAS,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACvC,OAAO,SAAS,SAAS,cAAc,CAAC,UAAU;IACpD;IAEA,IAAI,UAAyB;QAC3B,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,UAAyB,EAAE;QAC/B,IAAI,MAAM;YACR,UAAU,CAAA,GAAA,aAAK,EAAE,MAAM,cAAc,CAAC;YACtC,I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u.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, waitFor, within} from '@testing-library/react';\nimport {BaseTesterOpts, UserOpts} from './user';\nimport {triggerLongPress} from './events';\n\nexport interface MenuOptions extends UserOpts, BaseTesterOpts {\n user?: any,\n isSubmenu?: boolean\n}\nexport class MenuTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _trigger: HTMLElement | undefined;\n private _isSubmenu: boolean = false;\n\n constructor(opts: MenuOptions) {\n let {root, user, interactionType, advanceTimer, isSubmenu} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n\n // Handle case where a submenu trigger is provided to the tester\n if (root.getAttribute('role') === 'menuitem') {\n this._trigger = root;\n } else {\n // Handle case where element provided is a wrapper of the trigger button\n let trigger = within(root).queryByRole('button');\n if (trigger) {\n this._trigger = trigger;\n } else {\n this._trigger = root;\n }\n }\n\n this._isSubmenu = isSubmenu || false;\n }\n\n setInteractionType = (type: UserOpts['interactionType']) => {\n this._interactionType = type;\n };\n\n // TODO: this has been common to select as well, maybe make select use it? Or make a generic method. Will need to make error messages generic\n // One difference will be that it supports long press as well\n open = async (opts: {needsLongPress?: boolean, interactionType?: UserOpts['interactionType'], direction?: 'up' | 'down'} = {}) => {\n let {\n needsLongPress,\n interactionType = this._interactionType,\n direction\n } = opts;\n let trigger = this.trigger;\n let isDisabled = trigger.hasAttribute('disabled');\n if (interactionType === 'mouse' || interactionType === 'touch') {\n if (needsLongPress) {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n let pointerType = interactionType === 'mouse' ? 'mouse' : 'touch';\n await triggerLongPress({element: trigger, advanceTimer: this._advanceTimer, pointerOpts: {pointerType}});\n } else if (interactionType === 'mouse') {\n await this.user.click(trigger);\n } else {\n await this.user.pointer({target: trigger, keys: '[TouchA]'});\n }\n } else if (interactionType === 'keyboard' && !isDisabled) {\n if (direction === 'up') {\n act(() => trigger.focus());\n await this.user.keyboard('[ArrowUp]');\n } else if (direction === 'down') {\n act(() => trigger.focus());\n await this.user.keyboard('[ArrowDown]');\n } else {\n act(() => trigger.focus());\n await this.user.keyboard('[Enter]');\n }\n }\n\n await waitFor(() => {\n if (trigger.getAttribute('aria-controls') == null && !isDisabled) {\n throw new Error('No aria-controls found on menu trigger element.');\n } else {\n return true;\n }\n });\n if (!isDisabled) {\n let menuId = trigger.getAttribute('aria-controls');\n await waitFor(() => {\n if (!menuId || document.getElementById(menuId) == null) {\n throw new Error(`Menu with id of ${menuId} not found in document.`);\n } else {\n return true;\n }\n });\n }\n };\n\n // TODO: also very similar to select, barring potential long press support\n // Close on select is also kinda specific?\n selectOption = async (opts: {\n option?: HTMLElement,\n optionText?: string,\n menuSelectionMode?: 'single' | 'multiple',\n needsLongPress?: boolean,\n closesOnSelect?: boolean,\n interactionType?: UserOpts['interactionType'],\n keyboardActivation?: 'Space' | 'Enter'\n }) => {\n let {\n optionText,\n menuSelectionMode = 'single',\n needsLongPress,\n closesOnSelect = true,\n option,\n interactionType = this._interactionType,\n keyboardActivation = 'Enter'\n } = opts;\n let trigger = this.trigger;\n\n if (!trigger.getAttribute('aria-controls') && !trigger.hasAttribute('aria-expanded')) {\n await this.open({needsLongPress});\n }\n\n let menu = this.menu;\n if (menu) {\n if (!option && optionText) {\n option = (within(menu!).getByText(optionText).closest('[role=menuitem], [role=menuitemradio], [role=menuitemcheckbox]'))! as HTMLElement;\n }\n if (!option) {\n throw new Error('No option found in the menu.');\n }\n\n if (interactionType === 'keyboard') {\n if (document.activeElement !== menu || !menu.contains(document.activeElement)) {\n act(() => menu.focus());\n }\n\n await this.keyboardNavigateToOption({option});\n await this.user.keyboard(`[${keyboardActivation}]`);\n } else {\n if (interactionType === 'mouse') {\n await this.user.click(option);\n } else {\n await this.user.pointer({target: option, keys: '[TouchA]'});\n }\n }\n act(() => {jest.runAllTimers();});\n\n if (option && option.getAttribute('href') == null && option.getAttribute('aria-haspopup') == null && menuSelectionMode === 'single' && closesOnSelect && keyboardActivation !== 'Space' && !this._isSubmenu) {\n await waitFor(() => {\n if (document.activeElement !== trigger) {\n throw new Error(`Expected the document.activeElement after selecting an option to be the menu trigger but got ${document.activeElement}`);\n } else {\n return true;\n }\n });\n\n if (document.contains(menu)) {\n throw new Error('Expected menu element to not be in the document after selecting an option');\n }\n }\n } else {\n throw new Error(\"Attempted to select a option in the menu, but menu wasn't found.\");\n }\n };\n\n // TODO: update this to remove needsLongPress if we wanna make the user call open first always\n openSubmenu = async (opts: {submenuTrigger?: HTMLElement, submenuTriggerText?: string, needsLongPress?: boolean, interactionType?: UserOpts['interactionType']}): Promise<MenuTester | null> => {\n let {\n submenuTrigger,\n submenuTriggerText,\n needsLongPress,\n interactionType = this._interactionType\n } = opts;\n\n let trigger = this.trigger;\n let isDisabled = trigger.hasAttribute('disabled');\n if (!trigger.getAttribute('aria-controls') && !isDisabled) {\n await this.open({needsLongPress});\n }\n if (!isDisabled) {\n let menu = this.menu;\n if (menu) {\n let submenu;\n if (submenuTrigger) {\n submenu = submenuTrigger;\n } else if (submenuTriggerText) {\n submenu = within(menu).getByText(submenuTriggerText);\n }\n\n let submenuTriggerTester = new MenuTester({user: this.user, interactionType: this._interactionType, root: submenu, isSubmenu: true});\n if (interactionType === 'mouse') {\n await this.user.pointer({target: submenu});\n act(() => {jest.runAllTimers();});\n } else if (interactionType === 'keyboard') {\n await this.keyboardNavigateToOption({option: submenu});\n await this.user.keyboard('[ArrowRight]');\n act(() => {jest.runAllTimers();});\n } else {\n await submenuTriggerTester.open();\n }\n\n\n return submenuTriggerTester;\n }\n }\n\n return null;\n };\n\n keyboardNavigateToOption = async (opts: {option: HTMLElement}) => {\n let {option} = opts;\n let options = this.options;\n let targetIndex = options.indexOf(option);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the menu');\n }\n if (document.activeElement === this.menu) {\n await this.user.keyboard('[ArrowDown]');\n }\n let currIndex = options.indexOf(document.activeElement as HTMLElement);\n if (targetIndex === -1) {\n throw new Error('ActiveElement is not in the menu');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n\n close = async () => {\n let menu = this.menu;\n if (menu) {\n act(() => menu.focus());\n await this.user.keyboard('[Escape]');\n\n await waitFor(() => {\n if (document.activeElement !== this.trigger) {\n throw new Error(`Expected the document.activeElement after closing the menu to be the menu trigger but got ${document.activeElement}`);\n } else {\n return true;\n }\n });\n\n if (document.contains(menu)) {\n throw new Error('Expected the menu to not be in the document after closing it.');\n }\n }\n };\n\n get trigger() {\n if (!this._trigger) {\n throw new Error('No trigger element found for menu.');\n }\n return this._trigger;\n }\n\n get menu() {\n let menuId = this.trigger.getAttribute('aria-controls');\n return menuId ? document.getElementById(menuId) : undefined;\n }\n\n get options(): HTMLElement[] {\n let menu = this.menu;\n let options: HTMLElement[] = [];\n if (menu) {\n options = within(menu).queryAllByRole('menuitem');\n if (options.length === 0) {\n options = within(menu).queryAllByRole('menuitemradio');\n if (options.length === 0) {\n options = within(menu).queryAllByRole('menuitemcheckbox');\n }\n }\n }\n\n return options;\n }\n\n get sections() {\n let menu = this.menu;\n if (menu) {\n return within(menu).queryAllByRole('group');\n } else {\n return [];\n }\n }\n\n get submenuTriggers() {\n let options = this.options;\n if (options.length > 0) {\n return this.options.filter(item => item.getAttribute('aria-haspopup') != null);\n }\n\n return [];\n }\n}\n"],"names":[],"version":3,"file":"menu.module.js.map"}
package/dist/module.js CHANGED
@@ -1,6 +1,7 @@
1
- import {DEFAULT_LONG_PRESS_TIME as $5d1eca18f92ad0e6$export$4bd1d2d5ba6f5eaf, triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.module.js";
1
+ import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.module.js";
2
2
  import {installMouseEvent as $68df97871cfb5e33$export$de31e3987c917741, installPointerEvent as $68df97871cfb5e33$export$82f0b04c1d69a901} from "./testSetup.module.js";
3
3
  import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./userEventMaps.module.js";
4
+ import {User as $0d71b4e9cc4df40a$export$1f44aaf2ec115b54} from "./user.module.js";
4
5
 
5
6
  /*
6
7
  * Copyright 2023 Adobe. All rights reserved.
@@ -17,5 +18,6 @@ import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./userEve
17
18
 
18
19
 
19
20
 
20
- export {$5d1eca18f92ad0e6$export$4bd1d2d5ba6f5eaf as DEFAULT_LONG_PRESS_TIME, $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b as triggerLongPress, $68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent, $50ecfb18069ec897$export$7dbde2c4caaa8d35 as pointerMap};
21
+
22
+ export {$5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b as triggerLongPress, $68df97871cfb5e33$export$de31e3987c917741 as installMouseEvent, $68df97871cfb5e33$export$82f0b04c1d69a901 as installPointerEvent, $50ecfb18069ec897$export$7dbde2c4caaa8d35 as pointerMap, $0d71b4e9cc4df40a$export$1f44aaf2ec115b54 as User};
21
23
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/test-utils/src/index.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\nexport * from './events';\nexport * from './testSetup';\nexport * from './userEventMaps';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/test-utils/src/index.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\nexport {triggerLongPress} from './events';\nexport {installMouseEvent, installPointerEvent} from './testSetup';\nexport {pointerMap} from './userEventMaps';\nexport {User} from './user';\n\nexport type {UserOpts} from './user';\n"],"names":[],"version":3,"file":"module.js.map"}