q2-tecton-elements 1.47.1 → 1.47.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/cjs/click-elsewhere_2.cjs.entry.js +61 -25
- package/dist/cjs/click-elsewhere_2.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +55 -7
- package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/collection/components/q2-popover/q2-popover.css +19 -11
- package/dist/collection/components/q2-popover/q2-popover.js +62 -25
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-select/q2-select.js +64 -9
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/components/q2-popover2.js +61 -25
- package/dist/components/q2-popover2.js.map +1 -1
- package/dist/components/q2-select2.js +57 -9
- package/dist/components/q2-select2.js.map +1 -1
- package/dist/esm/click-elsewhere_2.entry.js +61 -25
- package/dist/esm/click-elsewhere_2.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-select.entry.js +56 -8
- package/dist/esm/q2-select.entry.js.map +1 -1
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/jest.setup.js +22 -0
- package/dist/jest.setup.js.map +1 -0
- package/dist/q2-tecton-elements/p-0499abaa.entry.js +2 -0
- package/dist/q2-tecton-elements/p-0499abaa.entry.js.map +1 -0
- package/dist/q2-tecton-elements/p-c9866d11.entry.js +2 -0
- package/dist/q2-tecton-elements/p-c9866d11.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
- package/dist/test/elements/q2-calendar-test.e2e.js +2 -2
- package/dist/test/elements/q2-calendar-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-dropdown-test.e2e.js +2 -14
- package/dist/test/elements/q2-dropdown-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-pill-test.e2e.js +1 -1
- package/dist/test/elements/q2-pill-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-popover-test.e2e.js +1 -34
- package/dist/test/elements/q2-popover-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-popover-test.spec.js +739 -296
- package/dist/test/elements/q2-popover-test.spec.js.map +1 -1
- package/dist/test/elements/q2-select-test.e2e.js +1 -1
- package/dist/test/elements/q2-select-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-select-test.spec.js +412 -0
- package/dist/test/elements/q2-select-test.spec.js.map +1 -0
- package/dist/test/elements/q2-tag-test.e2e.js +1 -1
- package/dist/test/elements/q2-tag-test.e2e.js.map +1 -1
- package/dist/types/builds/q2e/development/tecton/tecton/packages/q2-tecton-elements/.stencil/jest.setup.d.ts +1 -0
- package/dist/types/components/q2-popover/q2-popover.d.ts +5 -3
- package/dist/types/components/q2-select/q2-select.d.ts +7 -0
- package/package.json +3 -3
- package/dist/q2-tecton-elements/p-94acf745.entry.js +0 -2
- package/dist/q2-tecton-elements/p-94acf745.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-97e01336.entry.js +0 -2
- package/dist/q2-tecton-elements/p-97e01336.entry.js.map +0 -1
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
+
import { Q2Select } from "../../collection/components/q2-select/q2-select";
|
|
3
|
+
import { Q2OptionList } from "../../collection/components/q2-option-list/q2-option-list";
|
|
4
|
+
import * as utils from "../../collection/utils/index";
|
|
5
|
+
// Set up global screen object for testing
|
|
6
|
+
const mockScreen = {
|
|
7
|
+
orientation: {
|
|
8
|
+
type: 'portrait-primary',
|
|
9
|
+
addEventListener: jest.fn(),
|
|
10
|
+
removeEventListener: jest.fn(),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
global.screen = mockScreen;
|
|
14
|
+
Object.defineProperty(window, 'screen', {
|
|
15
|
+
writable: true,
|
|
16
|
+
value: mockScreen,
|
|
17
|
+
});
|
|
18
|
+
// Set up global visualViewport for testing
|
|
19
|
+
const mockVisualViewport = {
|
|
20
|
+
addEventListener: jest.fn(),
|
|
21
|
+
removeEventListener: jest.fn(),
|
|
22
|
+
width: 800,
|
|
23
|
+
height: 600,
|
|
24
|
+
};
|
|
25
|
+
global.visualViewport = mockVisualViewport;
|
|
26
|
+
Object.defineProperty(window, 'visualViewport', {
|
|
27
|
+
value: mockVisualViewport,
|
|
28
|
+
configurable: true,
|
|
29
|
+
});
|
|
30
|
+
const samplePlatformDimensions = {
|
|
31
|
+
scrollY: 0,
|
|
32
|
+
innerHeight: 800,
|
|
33
|
+
innerWidth: 600,
|
|
34
|
+
outletOffset: 20,
|
|
35
|
+
};
|
|
36
|
+
const sampleTectonWindow = {
|
|
37
|
+
inMobileApp: false,
|
|
38
|
+
noStrings: false,
|
|
39
|
+
platformUrl: '',
|
|
40
|
+
platformDimensions: samplePlatformDimensions,
|
|
41
|
+
};
|
|
42
|
+
describe('q2-select', () => {
|
|
43
|
+
let specPage;
|
|
44
|
+
let specSelect;
|
|
45
|
+
let specElement;
|
|
46
|
+
let isMobileSpy;
|
|
47
|
+
let handleAriaLabelSpy;
|
|
48
|
+
let overrideFocusSpy;
|
|
49
|
+
// Helper function to set screen orientation type
|
|
50
|
+
const setOrientationType = (type) => {
|
|
51
|
+
mockScreen.orientation.type = type;
|
|
52
|
+
};
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
isMobileSpy = jest.spyOn(utils, 'isMobile').mockReturnValue(false);
|
|
55
|
+
handleAriaLabelSpy = jest.spyOn(utils, 'handleAriaLabel');
|
|
56
|
+
overrideFocusSpy = jest.spyOn(utils, 'overrideFocus');
|
|
57
|
+
setOrientationType('landscape-primary');
|
|
58
|
+
mockScreen.orientation.addEventListener.mockClear();
|
|
59
|
+
mockScreen.orientation.removeEventListener.mockClear();
|
|
60
|
+
});
|
|
61
|
+
afterEach(() => {
|
|
62
|
+
isMobileSpy.mockRestore();
|
|
63
|
+
handleAriaLabelSpy.mockRestore();
|
|
64
|
+
overrideFocusSpy.mockRestore();
|
|
65
|
+
});
|
|
66
|
+
describe('Props', () => { });
|
|
67
|
+
describe('Events', () => { });
|
|
68
|
+
describe('Component Lifecycle Events', () => {
|
|
69
|
+
describe('disconnectedCallback', () => {
|
|
70
|
+
it('calls disconnect() on mutationObserver', async () => {
|
|
71
|
+
specSelect = new Q2Select();
|
|
72
|
+
specSelect.mutationObserver = new MutationObserver(() => { });
|
|
73
|
+
const disconnectSpy = jest.spyOn(specSelect.mutationObserver, 'disconnect');
|
|
74
|
+
specSelect.disconnectedCallback();
|
|
75
|
+
expect(disconnectSpy).toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
it('sets mutationObserver to null', async () => {
|
|
78
|
+
specSelect = new Q2Select();
|
|
79
|
+
specSelect.mutationObserver = new MutationObserver(() => { });
|
|
80
|
+
expect(specSelect.mutationObserver).not.toBeNull();
|
|
81
|
+
specSelect.disconnectedCallback();
|
|
82
|
+
expect(specSelect.mutationObserver).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
it('calls destroyEventListeners', async () => {
|
|
85
|
+
specSelect = new Q2Select();
|
|
86
|
+
const destroyEventListenersSpy = jest.spyOn(specSelect, 'destroyEventListeners');
|
|
87
|
+
specSelect.disconnectedCallback();
|
|
88
|
+
expect(destroyEventListenersSpy).toHaveBeenCalled();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe('componentWillLoad', () => {
|
|
92
|
+
it('calls handleAriaLabel() helper function', async () => {
|
|
93
|
+
specSelect = new Q2Select();
|
|
94
|
+
specSelect.componentWillLoad();
|
|
95
|
+
expect(handleAriaLabelSpy).toHaveBeenCalled();
|
|
96
|
+
});
|
|
97
|
+
it('calls handleOrientationChange', async () => {
|
|
98
|
+
specSelect = new Q2Select();
|
|
99
|
+
const handleOrientationChangeSpy = jest.spyOn(specSelect, 'handleOrientationChange');
|
|
100
|
+
specSelect.componentWillLoad();
|
|
101
|
+
expect(handleOrientationChangeSpy).toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
it('calls buildStructuredSelectedOptions', async () => {
|
|
104
|
+
specSelect = new Q2Select();
|
|
105
|
+
const buildOptionsSpy = jest.spyOn(specSelect, 'buildStructuredSelectedOptions');
|
|
106
|
+
specSelect.componentWillLoad();
|
|
107
|
+
expect(buildOptionsSpy).toHaveBeenCalled();
|
|
108
|
+
});
|
|
109
|
+
it('calls handleMultilineOptionsUpdate', async () => {
|
|
110
|
+
specSelect = new Q2Select();
|
|
111
|
+
const handleUpdateSpy = jest.spyOn(specSelect, 'handleMultilineOptionsUpdate');
|
|
112
|
+
specSelect.componentWillLoad();
|
|
113
|
+
expect(handleUpdateSpy).toHaveBeenCalled();
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('componentDidLoad', () => {
|
|
117
|
+
it('calls initMutationObserver', async () => {
|
|
118
|
+
specPage = await newSpecPage({
|
|
119
|
+
components: [Q2Select, Q2OptionList],
|
|
120
|
+
html: `<q2-select></q2-select>`,
|
|
121
|
+
});
|
|
122
|
+
specSelect = specPage.rootInstance;
|
|
123
|
+
const initMutationObserverSpy = jest.spyOn(specSelect, 'initMutationObserver');
|
|
124
|
+
specSelect.componentDidLoad();
|
|
125
|
+
expect(initMutationObserverSpy).toHaveBeenCalled();
|
|
126
|
+
});
|
|
127
|
+
it('calls initEventListeners', async () => {
|
|
128
|
+
specPage = await newSpecPage({
|
|
129
|
+
components: [Q2Select],
|
|
130
|
+
html: `<q2-select></q2-select>`,
|
|
131
|
+
});
|
|
132
|
+
specSelect = specPage.rootInstance;
|
|
133
|
+
const initEventListenersSpy = jest.spyOn(specSelect, 'initEventListeners');
|
|
134
|
+
specSelect.componentDidLoad();
|
|
135
|
+
expect(initEventListenersSpy).toHaveBeenCalled();
|
|
136
|
+
});
|
|
137
|
+
it('calls overrideFocus helper', async () => {
|
|
138
|
+
specPage = await newSpecPage({
|
|
139
|
+
components: [Q2Select],
|
|
140
|
+
html: `<q2-select></q2-select>`,
|
|
141
|
+
});
|
|
142
|
+
specSelect = specPage.rootInstance;
|
|
143
|
+
specElement = specPage.root;
|
|
144
|
+
specSelect.componentDidLoad();
|
|
145
|
+
expect(overrideFocusSpy).toHaveBeenCalledWith(specElement);
|
|
146
|
+
});
|
|
147
|
+
it('setTimeout calls checkSelectedDisplay', async () => {
|
|
148
|
+
specPage = await newSpecPage({
|
|
149
|
+
components: [Q2Select],
|
|
150
|
+
html: `<q2-select></q2-select>`,
|
|
151
|
+
});
|
|
152
|
+
specSelect = specPage.rootInstance;
|
|
153
|
+
const checkSelectedDisplaySpy = jest.spyOn(specSelect, 'checkSelectedDisplay');
|
|
154
|
+
jest.useFakeTimers();
|
|
155
|
+
specSelect.componentDidLoad();
|
|
156
|
+
jest.runAllTimers();
|
|
157
|
+
expect(checkSelectedDisplaySpy).toHaveBeenCalled();
|
|
158
|
+
jest.useRealTimers();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
describe('componentDidRender', () => {
|
|
162
|
+
it('calls forEach on scheduledAfterRender', async () => {
|
|
163
|
+
specSelect = new Q2Select();
|
|
164
|
+
specSelect.scheduledAfterRender = [jest.fn()];
|
|
165
|
+
const forEachSpy = jest.spyOn(specSelect.scheduledAfterRender, 'forEach');
|
|
166
|
+
jest.useFakeTimers();
|
|
167
|
+
specSelect.componentDidRender();
|
|
168
|
+
jest.runAllTimers();
|
|
169
|
+
expect(forEachSpy).toHaveBeenCalled();
|
|
170
|
+
jest.useRealTimers();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
describe('Listeners', () => { });
|
|
175
|
+
describe('Public Methods API', () => {
|
|
176
|
+
describe('Public Methods', () => { });
|
|
177
|
+
describe('Test Methods', () => { });
|
|
178
|
+
});
|
|
179
|
+
describe('Watchers', () => { });
|
|
180
|
+
describe('Local Methods', () => {
|
|
181
|
+
describe('Getters', () => {
|
|
182
|
+
describe('isModule', () => {
|
|
183
|
+
beforeEach(() => {
|
|
184
|
+
specSelect = new Q2Select();
|
|
185
|
+
});
|
|
186
|
+
it('returns false when window top matches window and platformDimensions is not defined', async () => {
|
|
187
|
+
expect(window.top).toBe(window);
|
|
188
|
+
expect(window.Tecton).toBeUndefined();
|
|
189
|
+
expect(specSelect.isModule).toBe(false);
|
|
190
|
+
});
|
|
191
|
+
it('returns false when window top does not match window and platformDimensions is not defined', async () => {
|
|
192
|
+
const windowSpy = jest.spyOn(window, 'top', 'get').mockReturnValue({});
|
|
193
|
+
expect(window.top).not.toEqual(window);
|
|
194
|
+
expect(window.Tecton).toBeUndefined();
|
|
195
|
+
expect(specSelect.isModule).toBe(false);
|
|
196
|
+
windowSpy.mockRestore();
|
|
197
|
+
});
|
|
198
|
+
it('returns false when window top matches window and platformDimensions is defined', async () => {
|
|
199
|
+
window.Tecton = sampleTectonWindow;
|
|
200
|
+
expect(window.top).toBe(window);
|
|
201
|
+
expect(window.Tecton.platformDimensions).toBeTruthy();
|
|
202
|
+
expect(specSelect.isModule).toBe(false);
|
|
203
|
+
});
|
|
204
|
+
it('returns true when window top does not match window and platformDimensions is defined', async () => {
|
|
205
|
+
const windowSpy = jest.spyOn(window, 'top', 'get').mockReturnValue({});
|
|
206
|
+
window.Tecton = sampleTectonWindow;
|
|
207
|
+
expect(specSelect.isModule).toBe(true);
|
|
208
|
+
windowSpy.mockRestore();
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
describe('Methods', () => {
|
|
213
|
+
describe('destroyEventListeners', () => {
|
|
214
|
+
let windowRemoveEventListenerSpy;
|
|
215
|
+
beforeEach(() => {
|
|
216
|
+
isMobileSpy.mockReturnValue(true);
|
|
217
|
+
specSelect = new Q2Select();
|
|
218
|
+
mockScreen.orientation.removeEventListener.mockClear();
|
|
219
|
+
windowRemoveEventListenerSpy = jest.spyOn(window, 'removeEventListener');
|
|
220
|
+
mockVisualViewport.removeEventListener.mockClear();
|
|
221
|
+
});
|
|
222
|
+
it('checks if isMobile', async () => {
|
|
223
|
+
specSelect = new Q2Select();
|
|
224
|
+
specSelect.destroyEventListeners();
|
|
225
|
+
expect(isMobileSpy).toHaveBeenCalled();
|
|
226
|
+
});
|
|
227
|
+
describe('when in mobile environment', () => {
|
|
228
|
+
it('calls removeEventListener on screen.orientation ', async () => {
|
|
229
|
+
specSelect.destroyEventListeners();
|
|
230
|
+
expect(mockScreen.orientation.removeEventListener).toHaveBeenCalledWith('change', specSelect.handleOrientationChange);
|
|
231
|
+
});
|
|
232
|
+
it('calls removeEventListener on window', async () => {
|
|
233
|
+
specSelect.destroyEventListeners();
|
|
234
|
+
expect(windowRemoveEventListenerSpy).toHaveBeenCalledWith('resize', specSelect.handleOrientationChange);
|
|
235
|
+
});
|
|
236
|
+
it('calls removeEventListener on visualViewport', async () => {
|
|
237
|
+
mockVisualViewport.removeEventListener.mockClear();
|
|
238
|
+
specSelect.destroyEventListeners();
|
|
239
|
+
expect(mockVisualViewport.removeEventListener).toHaveBeenCalledWith('resize', specSelect.handleOrientationChange);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
it('does NOT remove event listener when NOT mobile', async () => {
|
|
243
|
+
isMobileSpy.mockReturnValue(false);
|
|
244
|
+
specSelect = new Q2Select();
|
|
245
|
+
specSelect.destroyEventListeners();
|
|
246
|
+
expect(mockScreen.orientation.removeEventListener).not.toHaveBeenCalled();
|
|
247
|
+
expect(windowRemoveEventListenerSpy).not.toHaveBeenCalled();
|
|
248
|
+
expect(mockVisualViewport.removeEventListener).not.toHaveBeenCalled();
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
describe('handleOrientationChange', () => {
|
|
252
|
+
beforeEach(() => {
|
|
253
|
+
isMobileSpy.mockReturnValue(true);
|
|
254
|
+
specSelect = new Q2Select();
|
|
255
|
+
});
|
|
256
|
+
it('checks if isMobile', async () => {
|
|
257
|
+
specSelect.handleOrientationChange();
|
|
258
|
+
expect(isMobileSpy).toHaveBeenCalled();
|
|
259
|
+
});
|
|
260
|
+
describe('when searchable is initially true', () => {
|
|
261
|
+
beforeEach(() => {
|
|
262
|
+
specSelect.searchable = true;
|
|
263
|
+
specSelect.originalSearchable = true;
|
|
264
|
+
});
|
|
265
|
+
it('sets "searchable" to false if in landscape orientation', async () => {
|
|
266
|
+
setOrientationType('landscape-primary');
|
|
267
|
+
specSelect.handleOrientationChange();
|
|
268
|
+
expect(specSelect.searchable).toBe(false);
|
|
269
|
+
});
|
|
270
|
+
it('does nothing in portrait orientation', async () => {
|
|
271
|
+
setOrientationType('portrait-primary');
|
|
272
|
+
specSelect.handleOrientationChange();
|
|
273
|
+
expect(specSelect.searchable).toBe(true);
|
|
274
|
+
});
|
|
275
|
+
it('restores searchable when returning to portrait', async () => {
|
|
276
|
+
setOrientationType('landscape-primary');
|
|
277
|
+
specSelect.handleOrientationChange();
|
|
278
|
+
expect(specSelect.searchable).toBe(false);
|
|
279
|
+
setOrientationType('portrait-primary');
|
|
280
|
+
specSelect.handleOrientationChange();
|
|
281
|
+
expect(specSelect.searchable).toBe(true);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
describe('when searchable is initially undefined/false', () => {
|
|
285
|
+
it('does nothing', async () => {
|
|
286
|
+
specSelect.originalSearchable = false;
|
|
287
|
+
setOrientationType('landscape-primary');
|
|
288
|
+
specSelect.handleOrientationChange();
|
|
289
|
+
expect(specSelect.searchable).toBe(false);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
describe('initEventListeners', () => {
|
|
294
|
+
let windowAddEventListenerSpy;
|
|
295
|
+
beforeEach(() => {
|
|
296
|
+
isMobileSpy.mockReturnValue(true);
|
|
297
|
+
specSelect = new Q2Select();
|
|
298
|
+
mockScreen.orientation.addEventListener.mockClear();
|
|
299
|
+
windowAddEventListenerSpy = jest.spyOn(window, 'addEventListener');
|
|
300
|
+
mockVisualViewport.addEventListener.mockClear();
|
|
301
|
+
});
|
|
302
|
+
it('checks if isMobile', async () => {
|
|
303
|
+
specSelect = new Q2Select();
|
|
304
|
+
specSelect.initEventListeners();
|
|
305
|
+
expect(isMobileSpy).toHaveBeenCalled();
|
|
306
|
+
});
|
|
307
|
+
describe('when in mobile environment', () => {
|
|
308
|
+
it('calls addEventListener on screen.orientation', async () => {
|
|
309
|
+
specSelect.initEventListeners();
|
|
310
|
+
expect(mockScreen.orientation.addEventListener).toHaveBeenCalledWith('change', specSelect.handleOrientationChange);
|
|
311
|
+
});
|
|
312
|
+
it('calls addEventListener on window', async () => {
|
|
313
|
+
specSelect.initEventListeners();
|
|
314
|
+
expect(windowAddEventListenerSpy).toHaveBeenCalledWith('resize', specSelect.handleOrientationChange);
|
|
315
|
+
});
|
|
316
|
+
it('calls addEventListener on visualViewport', async () => {
|
|
317
|
+
specSelect.initEventListeners();
|
|
318
|
+
expect(mockVisualViewport.addEventListener).toHaveBeenCalledWith('resize', specSelect.handleOrientationChange);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
it('does NOT add event listener when NOT mobile', async () => {
|
|
322
|
+
isMobileSpy.mockReturnValue(false);
|
|
323
|
+
specSelect = new Q2Select();
|
|
324
|
+
specSelect.initEventListeners();
|
|
325
|
+
expect(mockScreen.orientation.addEventListener).not.toHaveBeenCalled();
|
|
326
|
+
expect(mockVisualViewport.addEventListener).not.toHaveBeenCalled();
|
|
327
|
+
expect(windowAddEventListenerSpy).not.toHaveBeenCalled();
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
describe('Render Methods', () => { });
|
|
333
|
+
describe('Accessibility', () => {
|
|
334
|
+
describe('Keyboard Controls', () => {
|
|
335
|
+
let handleOptionListExternalKeydownSpy;
|
|
336
|
+
let q2Select;
|
|
337
|
+
beforeEach(async () => {
|
|
338
|
+
specPage = await newSpecPage({
|
|
339
|
+
components: [Q2Select, Q2OptionList],
|
|
340
|
+
html: `<q2-select></q2-select>`,
|
|
341
|
+
});
|
|
342
|
+
q2Select = specPage.root;
|
|
343
|
+
const q2SelectInstance = specPage.rootInstance;
|
|
344
|
+
handleOptionListExternalKeydownSpy = jest.spyOn(q2SelectInstance, 'handleOptionListExternalKeydown');
|
|
345
|
+
});
|
|
346
|
+
afterEach(() => {
|
|
347
|
+
handleOptionListExternalKeydownSpy.mockRestore();
|
|
348
|
+
});
|
|
349
|
+
it("'Tab' keypress not handled by q2-option-list", async () => {
|
|
350
|
+
const event = new KeyboardEvent('keydown', { key: 'Tab' });
|
|
351
|
+
q2Select.dispatchEvent(event);
|
|
352
|
+
await specPage.waitForChanges();
|
|
353
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
354
|
+
});
|
|
355
|
+
it("'Enter' keypress handled by q2-option-list", async () => {
|
|
356
|
+
const event = new KeyboardEvent('keydown', { key: 'Enter' });
|
|
357
|
+
q2Select.dispatchEvent(event);
|
|
358
|
+
await specPage.waitForChanges();
|
|
359
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
360
|
+
});
|
|
361
|
+
it("'ArrowUp' keypress handled by q2-option-list", async () => {
|
|
362
|
+
const event = new KeyboardEvent('keydown', { key: 'ArrowUp' });
|
|
363
|
+
q2Select.dispatchEvent(event);
|
|
364
|
+
await specPage.waitForChanges();
|
|
365
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
366
|
+
});
|
|
367
|
+
it("'ArrowDown' keypress handled by q2-option-list", async () => {
|
|
368
|
+
const event = new KeyboardEvent('keydown', { key: 'ArrowDown' });
|
|
369
|
+
q2Select.dispatchEvent(event);
|
|
370
|
+
await specPage.waitForChanges();
|
|
371
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
372
|
+
});
|
|
373
|
+
it("'Home' keypress handled by q2-option-list", async () => {
|
|
374
|
+
const event = new KeyboardEvent('keydown', { key: 'Home' });
|
|
375
|
+
q2Select.dispatchEvent(event);
|
|
376
|
+
await specPage.waitForChanges();
|
|
377
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
378
|
+
});
|
|
379
|
+
it("'End' keypress handled by q2-option-list", async () => {
|
|
380
|
+
const event = new KeyboardEvent('keydown', { key: 'End' });
|
|
381
|
+
q2Select.dispatchEvent(event);
|
|
382
|
+
await specPage.waitForChanges();
|
|
383
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
384
|
+
});
|
|
385
|
+
it("'PageUp' keypress handled by q2-option-list", async () => {
|
|
386
|
+
const event = new KeyboardEvent('keydown', { key: 'PageUp' });
|
|
387
|
+
q2Select.dispatchEvent(event);
|
|
388
|
+
await specPage.waitForChanges();
|
|
389
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
390
|
+
});
|
|
391
|
+
it("'PageDown' keypress handled by q2-option-list", async () => {
|
|
392
|
+
const event = new KeyboardEvent('keydown', { key: 'PageDown' });
|
|
393
|
+
q2Select.dispatchEvent(event);
|
|
394
|
+
await specPage.waitForChanges();
|
|
395
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
396
|
+
});
|
|
397
|
+
it("'Esc' keypress handled by q2-option-list", async () => {
|
|
398
|
+
const event = new KeyboardEvent('keydown', { key: 'Esc' });
|
|
399
|
+
q2Select.dispatchEvent(event);
|
|
400
|
+
await specPage.waitForChanges();
|
|
401
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
402
|
+
});
|
|
403
|
+
it("'Space' keypress handled by q2-option-list", async () => {
|
|
404
|
+
const event = new KeyboardEvent('keydown', { key: 'Space' });
|
|
405
|
+
q2Select.dispatchEvent(event);
|
|
406
|
+
await specPage.waitForChanges();
|
|
407
|
+
expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
//# sourceMappingURL=q2-select-test.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"q2-select-test.spec.js","sourceRoot":"","sources":["../../../test/elements/q2-select-test.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,UAAU,GAAG;IACf,WAAW,EAAE;QACT,IAAI,EAAE,kBAAkB;QACxB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;KACjC;CACJ,CAAC;AACD,MAAc,CAAC,MAAM,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;IACpC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,UAAU;CACpB,CAAC,CAAC;AAEH,2CAA2C;AAC3C,MAAM,kBAAkB,GAAG;IACvB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC9B,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;CACd,CAAC;AACD,MAAc,CAAC,cAAc,GAAG,kBAAkB,CAAC;AACpD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAC5C,KAAK,EAAE,kBAAkB;IACzB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG;IAC7B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,GAAG;IACf,YAAY,EAAE,EAAE;CACnB,CAAC;AAEF,M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a,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;gBAChE,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAEhC,MAAM,CAAC,kCAAkC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;gBACtD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC3D,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAEhC,MAAM,CAAC,kCAAkC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;gBACxD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC7D,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAEhC,MAAM,CAAC,kCAAkC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { SpecPage, newSpecPage } from '@stencil/core/testing';\nimport { Q2Select } from 'src/components/q2-select/q2-select';\nimport { Q2OptionList } from 'src/components/q2-option-list/q2-option-list';\nimport * as utils from 'src/utils';\n\n// Set up global screen object for testing\nconst mockScreen = {\n orientation: {\n type: 'portrait-primary',\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n },\n};\n(global as any).screen = mockScreen;\nObject.defineProperty(window, 'screen', {\n writable: true,\n value: mockScreen,\n});\n\n// Set up global visualViewport for testing\nconst mockVisualViewport = {\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n width: 800,\n height: 600,\n};\n(global as any).visualViewport = mockVisualViewport;\nObject.defineProperty(window, 'visualViewport', {\n value: mockVisualViewport,\n configurable: true,\n});\n\nconst samplePlatformDimensions = {\n scrollY: 0,\n innerHeight: 800,\n innerWidth: 600,\n outletOffset: 20,\n};\n\nconst sampleTectonWindow = {\n inMobileApp: false,\n noStrings: false,\n platformUrl: '',\n platformDimensions: samplePlatformDimensions,\n};\n\ndescribe('q2-select', () => {\n let specPage: SpecPage;\n let specSelect: Q2Select;\n let specElement;\n let isMobileSpy: jest.SpyInstance;\n let handleAriaLabelSpy: jest.SpyInstance;\n let overrideFocusSpy: jest.SpyInstance;\n\n // Helper function to set screen orientation type\n const setOrientationType = (type: string) => {\n mockScreen.orientation.type = type;\n };\n\n beforeEach(() => {\n isMobileSpy = jest.spyOn(utils, 'isMobile').mockReturnValue(false);\n handleAriaLabelSpy = jest.spyOn(utils, 'handleAriaLabel');\n overrideFocusSpy = jest.spyOn(utils, 'overrideFocus');\n\n setOrientationType('landscape-primary');\n\n (mockScreen.orientation.addEventListener as jest.Mock).mockClear();\n (mockScreen.orientation.removeEventListener as jest.Mock).mockClear();\n });\n\n afterEach(() => {\n isMobileSpy.mockRestore();\n handleAriaLabelSpy.mockRestore();\n overrideFocusSpy.mockRestore();\n });\n\n describe('Props', () => {});\n describe('Events', () => {});\n describe('Component Lifecycle Events', () => {\n describe('disconnectedCallback', () => {\n it('calls disconnect() on mutationObserver', async () => {\n specSelect = new Q2Select();\n specSelect.mutationObserver = new MutationObserver(() => {});\n const disconnectSpy = jest.spyOn(specSelect.mutationObserver, 'disconnect');\n specSelect.disconnectedCallback();\n\n expect(disconnectSpy).toHaveBeenCalled();\n });\n\n it('sets mutationObserver to null', async () => {\n specSelect = new Q2Select();\n specSelect.mutationObserver = new MutationObserver(() => {});\n\n expect(specSelect.mutationObserver).not.toBeNull();\n\n specSelect.disconnectedCallback();\n\n expect(specSelect.mutationObserver).toBeNull();\n });\n\n it('calls destroyEventListeners', async () => {\n specSelect = new Q2Select();\n const destroyEventListenersSpy = jest.spyOn(specSelect, 'destroyEventListeners');\n specSelect.disconnectedCallback();\n\n expect(destroyEventListenersSpy).toHaveBeenCalled();\n });\n });\n\n describe('componentWillLoad', () => {\n it('calls handleAriaLabel() helper function', async () => {\n specSelect = new Q2Select();\n specSelect.componentWillLoad();\n\n expect(handleAriaLabelSpy).toHaveBeenCalled();\n });\n\n it('calls handleOrientationChange', async () => {\n specSelect = new Q2Select();\n const handleOrientationChangeSpy = jest.spyOn(specSelect, 'handleOrientationChange');\n specSelect.componentWillLoad();\n\n expect(handleOrientationChangeSpy).toHaveBeenCalled();\n });\n\n it('calls buildStructuredSelectedOptions', async () => {\n specSelect = new Q2Select();\n const buildOptionsSpy = jest.spyOn(specSelect, 'buildStructuredSelectedOptions');\n specSelect.componentWillLoad();\n\n expect(buildOptionsSpy).toHaveBeenCalled();\n });\n\n it('calls handleMultilineOptionsUpdate', async () => {\n specSelect = new Q2Select();\n const handleUpdateSpy = jest.spyOn(specSelect, 'handleMultilineOptionsUpdate');\n specSelect.componentWillLoad();\n\n expect(handleUpdateSpy).toHaveBeenCalled();\n });\n });\n describe('componentDidLoad', () => {\n it('calls initMutationObserver', async () => {\n specPage = await newSpecPage({\n components: [Q2Select, Q2OptionList],\n html: `<q2-select></q2-select>`,\n });\n specSelect = specPage.rootInstance;\n const initMutationObserverSpy = jest.spyOn(specSelect, 'initMutationObserver');\n specSelect.componentDidLoad();\n\n expect(initMutationObserverSpy).toHaveBeenCalled();\n });\n\n it('calls initEventListeners', async () => {\n specPage = await newSpecPage({\n components: [Q2Select],\n html: `<q2-select></q2-select>`,\n });\n specSelect = specPage.rootInstance;\n const initEventListenersSpy = jest.spyOn(specSelect, 'initEventListeners');\n specSelect.componentDidLoad();\n\n expect(initEventListenersSpy).toHaveBeenCalled();\n });\n\n it('calls overrideFocus helper', async () => {\n specPage = await newSpecPage({\n components: [Q2Select],\n html: `<q2-select></q2-select>`,\n });\n specSelect = specPage.rootInstance;\n specElement = specPage.root;\n specSelect.componentDidLoad();\n\n expect(overrideFocusSpy).toHaveBeenCalledWith(specElement);\n });\n\n it('setTimeout calls checkSelectedDisplay', async () => {\n specPage = await newSpecPage({\n components: [Q2Select],\n html: `<q2-select></q2-select>`,\n });\n specSelect = specPage.rootInstance;\n const checkSelectedDisplaySpy = jest.spyOn(specSelect, 'checkSelectedDisplay');\n\n jest.useFakeTimers();\n specSelect.componentDidLoad();\n jest.runAllTimers();\n\n expect(checkSelectedDisplaySpy).toHaveBeenCalled();\n jest.useRealTimers();\n });\n });\n describe('componentDidRender', () => {\n it('calls forEach on scheduledAfterRender', async () => {\n specSelect = new Q2Select();\n specSelect.scheduledAfterRender = [jest.fn()];\n const forEachSpy = jest.spyOn(specSelect.scheduledAfterRender, 'forEach');\n\n jest.useFakeTimers();\n specSelect.componentDidRender();\n jest.runAllTimers();\n\n expect(forEachSpy).toHaveBeenCalled();\n jest.useRealTimers();\n });\n });\n });\n describe('Listeners', () => {});\n describe('Public Methods API', () => {\n describe('Public Methods', () => {});\n describe('Test Methods', () => {});\n });\n describe('Watchers', () => {});\n describe('Local Methods', () => {\n describe('Getters', () => {\n describe('isModule', () => {\n beforeEach(() => {\n specSelect = new Q2Select();\n });\n it('returns false when window top matches window and platformDimensions is not defined', async () => {\n expect(window.top).toBe(window);\n expect(window.Tecton).toBeUndefined();\n expect(specSelect.isModule).toBe(false);\n });\n\n it('returns false when window top does not match window and platformDimensions is not defined', async () => {\n const windowSpy = jest.spyOn(window, 'top', 'get').mockReturnValue({} as any);\n expect(window.top).not.toEqual(window);\n expect(window.Tecton).toBeUndefined();\n expect(specSelect.isModule).toBe(false);\n windowSpy.mockRestore();\n });\n\n it('returns false when window top matches window and platformDimensions is defined', async () => {\n window.Tecton = sampleTectonWindow;\n expect(window.top).toBe(window);\n expect(window.Tecton.platformDimensions).toBeTruthy();\n expect(specSelect.isModule).toBe(false);\n });\n\n it('returns true when window top does not match window and platformDimensions is defined', async () => {\n const windowSpy = jest.spyOn(window, 'top', 'get').mockReturnValue({} as any);\n window.Tecton = sampleTectonWindow;\n expect(specSelect.isModule).toBe(true);\n windowSpy.mockRestore();\n });\n });\n });\n describe('Methods', () => {\n describe('destroyEventListeners', () => {\n let windowRemoveEventListenerSpy: jest.SpyInstance;\n beforeEach(() => {\n isMobileSpy.mockReturnValue(true);\n specSelect = new Q2Select();\n mockScreen.orientation.removeEventListener.mockClear();\n windowRemoveEventListenerSpy = jest.spyOn(window, 'removeEventListener');\n mockVisualViewport.removeEventListener.mockClear();\n });\n\n it('checks if isMobile', async () => {\n specSelect = new Q2Select();\n specSelect.destroyEventListeners();\n\n expect(isMobileSpy).toHaveBeenCalled();\n });\n\n describe('when in mobile environment', () => {\n it('calls removeEventListener on screen.orientation ', async () => {\n specSelect.destroyEventListeners();\n\n expect(mockScreen.orientation.removeEventListener).toHaveBeenCalledWith(\n 'change',\n specSelect.handleOrientationChange\n );\n });\n\n it('calls removeEventListener on window', async () => {\n specSelect.destroyEventListeners();\n\n expect(windowRemoveEventListenerSpy).toHaveBeenCalledWith(\n 'resize',\n specSelect.handleOrientationChange\n );\n });\n\n it('calls removeEventListener on visualViewport', async () => {\n mockVisualViewport.removeEventListener.mockClear();\n specSelect.destroyEventListeners();\n expect(mockVisualViewport.removeEventListener).toHaveBeenCalledWith(\n 'resize',\n specSelect.handleOrientationChange\n );\n });\n });\n\n it('does NOT remove event listener when NOT mobile', async () => {\n isMobileSpy.mockReturnValue(false);\n specSelect = new Q2Select();\n specSelect.destroyEventListeners();\n\n expect(mockScreen.orientation.removeEventListener).not.toHaveBeenCalled();\n expect(windowRemoveEventListenerSpy).not.toHaveBeenCalled();\n expect(mockVisualViewport.removeEventListener).not.toHaveBeenCalled();\n });\n });\n\n describe('handleOrientationChange', () => {\n beforeEach(() => {\n isMobileSpy.mockReturnValue(true);\n specSelect = new Q2Select();\n });\n\n it('checks if isMobile', async () => {\n specSelect.handleOrientationChange();\n\n expect(isMobileSpy).toHaveBeenCalled();\n });\n\n describe('when searchable is initially true', () => {\n beforeEach(() => {\n specSelect.searchable = true;\n specSelect.originalSearchable = true;\n });\n\n it('sets \"searchable\" to false if in landscape orientation', async () => {\n setOrientationType('landscape-primary');\n specSelect.handleOrientationChange();\n\n expect(specSelect.searchable).toBe(false);\n });\n\n it('does nothing in portrait orientation', async () => {\n setOrientationType('portrait-primary');\n specSelect.handleOrientationChange();\n\n expect(specSelect.searchable).toBe(true);\n });\n\n it('restores searchable when returning to portrait', async () => {\n setOrientationType('landscape-primary');\n specSelect.handleOrientationChange();\n\n expect(specSelect.searchable).toBe(false);\n\n setOrientationType('portrait-primary');\n specSelect.handleOrientationChange();\n\n expect(specSelect.searchable).toBe(true);\n });\n });\n\n describe('when searchable is initially undefined/false', () => {\n it('does nothing', async () => {\n specSelect.originalSearchable = false;\n setOrientationType('landscape-primary');\n specSelect.handleOrientationChange();\n\n expect(specSelect.searchable).toBe(false);\n });\n });\n });\n\n describe('initEventListeners', () => {\n let windowAddEventListenerSpy: jest.SpyInstance;\n beforeEach(() => {\n isMobileSpy.mockReturnValue(true);\n specSelect = new Q2Select();\n mockScreen.orientation.addEventListener.mockClear();\n windowAddEventListenerSpy = jest.spyOn(window, 'addEventListener');\n mockVisualViewport.addEventListener.mockClear();\n });\n\n it('checks if isMobile', async () => {\n specSelect = new Q2Select();\n specSelect.initEventListeners();\n\n expect(isMobileSpy).toHaveBeenCalled();\n });\n\n describe('when in mobile environment', () => {\n it('calls addEventListener on screen.orientation', async () => {\n specSelect.initEventListeners();\n\n expect(mockScreen.orientation.addEventListener).toHaveBeenCalledWith(\n 'change',\n specSelect.handleOrientationChange\n );\n });\n\n it('calls addEventListener on window', async () => {\n specSelect.initEventListeners();\n\n expect(windowAddEventListenerSpy).toHaveBeenCalledWith(\n 'resize',\n specSelect.handleOrientationChange\n );\n });\n\n it('calls addEventListener on visualViewport', async () => {\n specSelect.initEventListeners();\n\n expect(mockVisualViewport.addEventListener).toHaveBeenCalledWith(\n 'resize',\n specSelect.handleOrientationChange\n );\n });\n });\n\n it('does NOT add event listener when NOT mobile', async () => {\n isMobileSpy.mockReturnValue(false);\n specSelect = new Q2Select();\n specSelect.initEventListeners();\n\n expect(mockScreen.orientation.addEventListener).not.toHaveBeenCalled();\n expect(mockVisualViewport.addEventListener).not.toHaveBeenCalled();\n expect(windowAddEventListenerSpy).not.toHaveBeenCalled();\n });\n });\n });\n });\n describe('Render Methods', () => {});\n\n describe('Accessibility', () => {\n describe('Keyboard Controls', () => {\n let handleOptionListExternalKeydownSpy: jest.SpyInstance;\n let q2Select: HTMLQ2SelectElement;\n beforeEach(async () => {\n specPage = await newSpecPage({\n components: [Q2Select, Q2OptionList],\n html: `<q2-select></q2-select>`,\n });\n q2Select = specPage.root as HTMLQ2SelectElement;\n const q2SelectInstance = specPage.rootInstance as Q2Select;\n handleOptionListExternalKeydownSpy = jest.spyOn(q2SelectInstance, 'handleOptionListExternalKeydown');\n });\n afterEach(() => {\n handleOptionListExternalKeydownSpy.mockRestore();\n });\n it(\"'Tab' keypress not handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'Tab' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'Enter' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'Enter' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'ArrowUp' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'ArrowUp' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'ArrowDown' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'ArrowDown' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'Home' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'Home' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'End' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'End' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'PageUp' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'PageUp' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'PageDown' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'PageDown' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'Esc' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'Esc' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n it(\"'Space' keypress handled by q2-option-list\", async () => {\n const event = new KeyboardEvent('keydown', { key: 'Space' });\n q2Select.dispatchEvent(event);\n await specPage.waitForChanges();\n\n expect(handleOptionListExternalKeydownSpy).toHaveBeenCalledWith(event);\n });\n });\n });\n});\n"]}
|
|
@@ -446,7 +446,7 @@ describe('q2-tag', () => {
|
|
|
446
446
|
await page.waitForChanges();
|
|
447
447
|
const snapshot = await page.accessibility.snapshot();
|
|
448
448
|
const button = snapshot.children[0];
|
|
449
|
-
const optionList = snapshot.children[1];
|
|
449
|
+
const optionList = snapshot.children[1].children[0];
|
|
450
450
|
expect(button.role).toEqual('combobox');
|
|
451
451
|
expect(optionList.role).toEqual('menu');
|
|
452
452
|
expect(optionList.children).toHaveLength(3);
|