@ons/design-system 70.0.13 → 70.0.14
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/README.md +2 -2
- package/components/access-code/_macro.spec.js +170 -136
- package/components/address-input/autosuggest.address.spec.js +17 -12
- package/components/autosuggest/autosuggest.spec.js +7 -5
- package/components/back-to-top/_macro.spec.js +42 -48
- package/components/back-to-top/back-to-top.spec.js +4 -2
- package/components/cookies-banner/cookies-banner.spec.js +1 -1
- package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +7 -5
- package/components/mutually-exclusive/mutually-exclusive.date.spec.js +10 -8
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +10 -8
- package/components/mutually-exclusive/mutually-exclusive.email.spec.js +6 -4
- package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +7 -5
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +6 -4
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +6 -4
- package/components/navigation/navigation.spec.js +8 -6
- package/components/table/table.spec.js +1 -1
- package/components/table-of-contents/toc.spec.js +4 -2
- package/components/timeout-modal/timeout-modal.spec.js +41 -36
- package/components/timeout-panel/timeout-panel.spec.js +4 -2
- package/components/video/video.spec.js +109 -85
- package/js/cookies-settings.spec.js +1 -1
- package/package.json +4 -3
|
@@ -4,7 +4,7 @@ const EXAMPLE_COOKIES_BANNER_PAGE = renderComponent('cookies-banner', {});
|
|
|
4
4
|
|
|
5
5
|
describe('script: cookies-banner', () => {
|
|
6
6
|
beforeEach(async () => {
|
|
7
|
-
const client = await page.
|
|
7
|
+
const client = await page.createCDPSession();
|
|
8
8
|
await client.send('Network.clearBrowserCookies');
|
|
9
9
|
});
|
|
10
10
|
|
|
@@ -60,6 +60,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_CHECKBOXES_PARAMS = {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const { setTimeout } = require('node:timers/promises');
|
|
64
|
+
|
|
63
65
|
describe('script: mutually-exclusive', () => {
|
|
64
66
|
describe('checkboxes', () => {
|
|
65
67
|
beforeEach(async () => {
|
|
@@ -93,7 +95,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
93
95
|
});
|
|
94
96
|
|
|
95
97
|
it('then the aria-live message should reflect the removed non exclusive options', async () => {
|
|
96
|
-
await
|
|
98
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
97
99
|
|
|
98
100
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
99
101
|
expect(alertText).toBe('Gas deselected. Electric deselected. Other deselected. Please specify deselected.');
|
|
@@ -125,7 +127,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
125
127
|
});
|
|
126
128
|
|
|
127
129
|
it('then the aria-live message should reflect the removed exclusive option', async () => {
|
|
128
|
-
await
|
|
130
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
129
131
|
|
|
130
132
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
131
133
|
expect(alertText).toBe('No central heating deselected.');
|
|
@@ -137,7 +139,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
137
139
|
});
|
|
138
140
|
|
|
139
141
|
it('the aria-live message should not be updated', async () => {
|
|
140
|
-
await
|
|
142
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
141
143
|
|
|
142
144
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
143
145
|
expect(alertText).toBe('No central heating deselected.');
|
|
@@ -166,7 +168,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
166
168
|
});
|
|
167
169
|
|
|
168
170
|
it('then the aria-live message should say nothing', async () => {
|
|
169
|
-
await
|
|
171
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
170
172
|
|
|
171
173
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
172
174
|
expect(alertText).toBe('');
|
|
@@ -192,7 +194,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
192
194
|
});
|
|
193
195
|
|
|
194
196
|
it('then the aria-live message should say nothing', async () => {
|
|
195
|
-
await
|
|
197
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
196
198
|
|
|
197
199
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
198
200
|
expect(alertText).toBe('');
|
|
@@ -70,6 +70,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DATE_SINGLE_PARAMS = {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
const { setTimeout } = require('node:timers/promises');
|
|
74
|
+
|
|
73
75
|
describe('script: mutually-exclusive', () => {
|
|
74
76
|
describe('date', () => {
|
|
75
77
|
beforeEach(async () => {
|
|
@@ -103,7 +105,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
it('then the aria alert should tell the user that the date input has been cleared', async () => {
|
|
106
|
-
await
|
|
108
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
107
109
|
|
|
108
110
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
109
111
|
expect(alertText).toBe('Day cleared. Month cleared. Year cleared.');
|
|
@@ -129,7 +131,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
129
131
|
});
|
|
130
132
|
|
|
131
133
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
132
|
-
await
|
|
134
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
133
135
|
|
|
134
136
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
135
137
|
expect(alertText).toBe('I have never had a paid job deselected.');
|
|
@@ -146,7 +148,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
146
148
|
});
|
|
147
149
|
|
|
148
150
|
it('then the aria alert shouldnt say anything', async () => {
|
|
149
|
-
await
|
|
151
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
150
152
|
|
|
151
153
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
152
154
|
expect(alertText).toBe('');
|
|
@@ -159,7 +161,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
159
161
|
});
|
|
160
162
|
|
|
161
163
|
it('then the aria alert shouldnt say anything', async () => {
|
|
162
|
-
await
|
|
164
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
163
165
|
|
|
164
166
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
165
167
|
expect(alertText).toBe('');
|
|
@@ -193,7 +195,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
193
195
|
});
|
|
194
196
|
|
|
195
197
|
it('then the aria alert should tell the user that the date input has been cleared', async () => {
|
|
196
|
-
await
|
|
198
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
197
199
|
|
|
198
200
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
199
201
|
expect(alertText).toBe('What year was your last MOT? cleared.');
|
|
@@ -217,7 +219,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
217
219
|
});
|
|
218
220
|
|
|
219
221
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
220
|
-
await
|
|
222
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
221
223
|
|
|
222
224
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
223
225
|
expect(alertText).toBe('I have never had a paid job deselected.');
|
|
@@ -232,7 +234,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
232
234
|
});
|
|
233
235
|
|
|
234
236
|
it('then the aria alert shouldnt say anything', async () => {
|
|
235
|
-
await
|
|
237
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
236
238
|
|
|
237
239
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
238
240
|
expect(alertText).toBe('');
|
|
@@ -245,7 +247,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
245
247
|
});
|
|
246
248
|
|
|
247
249
|
it('then the aria alert shouldnt say anything', async () => {
|
|
248
|
-
await
|
|
250
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
249
251
|
|
|
250
252
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
251
253
|
expect(alertText).toBe('');
|
|
@@ -70,6 +70,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_SINGLE_PARAMS = {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
const { setTimeout } = require('node:timers/promises');
|
|
74
|
+
|
|
73
75
|
describe('script: mutually-exclusive', () => {
|
|
74
76
|
describe('duration', () => {
|
|
75
77
|
beforeEach(async () => {
|
|
@@ -100,7 +102,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
100
102
|
});
|
|
101
103
|
|
|
102
104
|
it('then the aria alert should tell the user that the inputs have been cleared', async () => {
|
|
103
|
-
await
|
|
105
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
104
106
|
|
|
105
107
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
106
108
|
expect(alertText).toBe('Years cleared. Months cleared.');
|
|
@@ -125,7 +127,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
125
127
|
});
|
|
126
128
|
|
|
127
129
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
128
|
-
await
|
|
130
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
129
131
|
|
|
130
132
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
131
133
|
expect(alertText).toBe('I have not moved in to this address yet deselected.');
|
|
@@ -141,7 +143,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
141
143
|
});
|
|
142
144
|
|
|
143
145
|
it('then the aria alert shouldnt say anything', async () => {
|
|
144
|
-
await
|
|
146
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
145
147
|
|
|
146
148
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
147
149
|
expect(alertText).toBe('');
|
|
@@ -154,7 +156,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
154
156
|
});
|
|
155
157
|
|
|
156
158
|
it('then the aria alert shouldnt say anything', async () => {
|
|
157
|
-
await
|
|
159
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
158
160
|
|
|
159
161
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
160
162
|
expect(alertText).toBe('');
|
|
@@ -189,7 +191,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
189
191
|
});
|
|
190
192
|
|
|
191
193
|
it('then the aria alert should tell the user that the inputs have been cleared', async () => {
|
|
192
|
-
await
|
|
194
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
193
195
|
|
|
194
196
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
195
197
|
expect(alertText).toBe('How long have you lived at this address? cleared.');
|
|
@@ -213,7 +215,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
213
215
|
});
|
|
214
216
|
|
|
215
217
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
216
|
-
await
|
|
218
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
217
219
|
|
|
218
220
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
219
221
|
expect(alertText).toBe('I have not moved in to this address yet deselected.');
|
|
@@ -228,7 +230,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
228
230
|
});
|
|
229
231
|
|
|
230
232
|
it('then the aria alert shouldnt say anything', async () => {
|
|
231
|
-
await
|
|
233
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
232
234
|
|
|
233
235
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
234
236
|
expect(alertText).toBe('');
|
|
@@ -241,7 +243,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
241
243
|
});
|
|
242
244
|
|
|
243
245
|
it('then the aria alert shouldnt say anything', async () => {
|
|
244
|
-
await
|
|
246
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
245
247
|
|
|
246
248
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
247
249
|
expect(alertText).toBe('');
|
|
@@ -27,6 +27,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_EMAIL_INPUT_PARAMS = {
|
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const { setTimeout } = require('node:timers/promises');
|
|
31
|
+
|
|
30
32
|
describe('script: mutually-exclusive', () => {
|
|
31
33
|
describe('email input', () => {
|
|
32
34
|
beforeEach(async () => {
|
|
@@ -54,7 +56,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
it('then the aria alert should tell the user that the email input has been cleared', async () => {
|
|
57
|
-
await
|
|
59
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
58
60
|
|
|
59
61
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
60
62
|
expect(alertText).toBe('Enter an email cleared.');
|
|
@@ -78,7 +80,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
81
|
-
await
|
|
83
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
82
84
|
|
|
83
85
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
84
86
|
expect(alertText).toBe('I dont want to receive a confirmation email deselected.');
|
|
@@ -93,7 +95,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
93
95
|
});
|
|
94
96
|
|
|
95
97
|
it('then the aria alert shouldnt say anything', async () => {
|
|
96
|
-
await
|
|
98
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
97
99
|
|
|
98
100
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
99
101
|
expect(alertText).toBe('');
|
|
@@ -106,7 +108,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
106
108
|
});
|
|
107
109
|
|
|
108
110
|
it('then the aria alert shouldnt say anything', async () => {
|
|
109
|
-
await
|
|
111
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
110
112
|
|
|
111
113
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
112
114
|
expect(alertText).toBe('');
|
package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js
CHANGED
|
@@ -67,6 +67,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_CHECKBOXES_PARAMS = {
|
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
const { setTimeout } = require('node:timers/promises');
|
|
71
|
+
|
|
70
72
|
describe('script: mutually-exclusive', () => {
|
|
71
73
|
describe('checkboxes', () => {
|
|
72
74
|
beforeEach(async () => {
|
|
@@ -100,7 +102,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
100
102
|
});
|
|
101
103
|
|
|
102
104
|
it('then the aria-live message should reflect the removed non exclusive options', async () => {
|
|
103
|
-
await
|
|
105
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
104
106
|
|
|
105
107
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
106
108
|
expect(alertText).toBe('Gas deselected. Electric deselected. Other deselected. Please specify deselected.');
|
|
@@ -133,7 +135,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
133
135
|
});
|
|
134
136
|
|
|
135
137
|
it('then the aria-live message should reflect the removed exclusive option', async () => {
|
|
136
|
-
await
|
|
138
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
137
139
|
|
|
138
140
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
139
141
|
expect(alertText).toBe('Dont know deselected.');
|
|
@@ -145,7 +147,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
145
147
|
});
|
|
146
148
|
|
|
147
149
|
it('the aria-live message should not be updated', async () => {
|
|
148
|
-
await
|
|
150
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
149
151
|
|
|
150
152
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
151
153
|
expect(alertText).toBe('Dont know deselected.');
|
|
@@ -175,7 +177,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
175
177
|
});
|
|
176
178
|
|
|
177
179
|
it('then the aria-live message should say nothing', async () => {
|
|
178
|
-
await
|
|
180
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
179
181
|
|
|
180
182
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
181
183
|
expect(alertText).toBe('');
|
|
@@ -202,7 +204,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
202
204
|
});
|
|
203
205
|
|
|
204
206
|
it('then the aria-live message should say nothing', async () => {
|
|
205
|
-
await
|
|
207
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
206
208
|
|
|
207
209
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
208
210
|
expect(alertText).toBe('');
|
|
@@ -33,6 +33,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_NUMBER_INPUT_PARAMS = {
|
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
const { setTimeout } = require('node:timers/promises');
|
|
37
|
+
|
|
36
38
|
describe('script: mutually-exclusive', () => {
|
|
37
39
|
describe('number input', () => {
|
|
38
40
|
beforeEach(async () => {
|
|
@@ -60,7 +62,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
60
62
|
});
|
|
61
63
|
|
|
62
64
|
it('then the aria alert should tell the user that the number input has been cleared', async () => {
|
|
63
|
-
await
|
|
65
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
64
66
|
|
|
65
67
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
66
68
|
expect(alertText).toBe('Gross annual income cleared.');
|
|
@@ -84,7 +86,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
87
|
-
await
|
|
89
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
88
90
|
|
|
89
91
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
90
92
|
expect(alertText).toBe('I prefer not to say deselected.');
|
|
@@ -99,7 +101,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
99
101
|
});
|
|
100
102
|
|
|
101
103
|
it('then the aria alert shouldnt say anything', async () => {
|
|
102
|
-
await
|
|
104
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
103
105
|
|
|
104
106
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
105
107
|
expect(alertText).toBe('');
|
|
@@ -112,7 +114,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
112
114
|
});
|
|
113
115
|
|
|
114
116
|
it('then the aria alert shouldnt say anything', async () => {
|
|
115
|
-
await
|
|
117
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
116
118
|
|
|
117
119
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
118
120
|
expect(alertText).toBe('');
|
|
@@ -34,6 +34,8 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_TEXTAREA_PARAMS = {
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const { setTimeout } = require('node:timers/promises');
|
|
38
|
+
|
|
37
39
|
const FAKE_TEXTAREA_INPUT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
|
38
40
|
|
|
39
41
|
describe('script: mutually-exclusive', () => {
|
|
@@ -68,7 +70,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
68
70
|
});
|
|
69
71
|
|
|
70
72
|
it('then the aria alert should tell the user that the textarea has been cleared', async () => {
|
|
71
|
-
await
|
|
73
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
72
74
|
|
|
73
75
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
74
76
|
expect(alertText).toBe('Enter your feedback cleared.');
|
|
@@ -92,7 +94,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
95
|
-
await
|
|
97
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
96
98
|
|
|
97
99
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
98
100
|
expect(alertText).toBe('I dont want to provide feedback deselected.');
|
|
@@ -107,7 +109,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
it('then the aria alert shouldnt say anything', async () => {
|
|
110
|
-
await
|
|
112
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
111
113
|
|
|
112
114
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
113
115
|
expect(alertText).toBe('');
|
|
@@ -120,7 +122,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
120
122
|
});
|
|
121
123
|
|
|
122
124
|
it('then the aria alert shouldnt say anything', async () => {
|
|
123
|
-
await
|
|
125
|
+
await setTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
124
126
|
|
|
125
127
|
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
126
128
|
expect(alertText).toBe('');
|
|
@@ -230,12 +230,14 @@ describe('script: navigation', () => {
|
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
describe('when the toggle button is clicked to close the navigation list', () => {
|
|
233
|
+
const { setTimeout } = require('node:timers/promises');
|
|
234
|
+
|
|
233
235
|
beforeEach(async () => {
|
|
234
236
|
await page.focus(buttonEl);
|
|
235
237
|
await page.keyboard.press('Enter');
|
|
236
|
-
await
|
|
238
|
+
await setTimeout(100);
|
|
237
239
|
await page.keyboard.press('Enter');
|
|
238
|
-
await
|
|
240
|
+
await setTimeout(100);
|
|
239
241
|
});
|
|
240
242
|
|
|
241
243
|
it('has aria-hidden set as `true` on the navigation list', async () => {
|
|
@@ -270,14 +272,14 @@ describe('script: navigation', () => {
|
|
|
270
272
|
|
|
271
273
|
it('has the aria-hidden attribute removed from the navigation list', async () => {
|
|
272
274
|
const nav = await page.$(navEl);
|
|
273
|
-
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden')
|
|
274
|
-
expect(hasAriaAttribute).toBe(
|
|
275
|
+
const hasAriaAttribute = await nav.evaluate((node) => node.getAttribute('aria-hidden') === null);
|
|
276
|
+
expect(hasAriaAttribute).toBe(true);
|
|
275
277
|
});
|
|
276
278
|
|
|
277
279
|
it('has aria-expanded removed from the navigation toggle button', async () => {
|
|
278
280
|
const button = await page.$(buttonEl);
|
|
279
|
-
const hasAriaExpanded = await button.evaluate((node) => node.getAttribute('aria-expanded')
|
|
280
|
-
expect(hasAriaExpanded).toBe(
|
|
281
|
+
const hasAriaExpanded = await button.evaluate((node) => node.getAttribute('aria-expanded') === null);
|
|
282
|
+
expect(hasAriaExpanded).toBe(true);
|
|
281
283
|
});
|
|
282
284
|
|
|
283
285
|
it('has the hide class removed from the navigation list', async () => {
|
|
@@ -31,7 +31,7 @@ describe('script: table', () => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('should show both shadow elements', async () => {
|
|
34
|
-
await
|
|
34
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
35
35
|
|
|
36
36
|
const leftShadowVisibleCount = await page.$$eval('.ons-table__left-shadow.ons-visible', (nodes) => nodes.length);
|
|
37
37
|
expect(leftShadowVisibleCount).not.toBe(0);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { renderComponent, setTestPage } from '../../tests/helpers/rendering';
|
|
2
2
|
|
|
3
|
+
const { setTimeout } = require('node:timers/promises');
|
|
4
|
+
|
|
3
5
|
describe('script: table-of-contents', () => {
|
|
4
6
|
beforeEach(async () => {
|
|
5
7
|
await setTestPage(
|
|
@@ -55,7 +57,7 @@ describe('script: table-of-contents', () => {
|
|
|
55
57
|
['section3', 'Third section'],
|
|
56
58
|
])('marks "%s" as the current section', async (sectionId, sectionTitle) => {
|
|
57
59
|
await page.$eval(`#${sectionId}`, (node) => node.scrollIntoView());
|
|
58
|
-
await
|
|
60
|
+
await setTimeout(250);
|
|
59
61
|
|
|
60
62
|
const activeSection = await page.$eval('.ons-toc__link-active', (node) => node.innerText.trim());
|
|
61
63
|
expect(activeSection).toBe(sectionTitle);
|
|
@@ -154,7 +156,7 @@ describe('script: table-of-contents-fixed-position', () => {
|
|
|
154
156
|
window.scrollTo(0, 1000);
|
|
155
157
|
});
|
|
156
158
|
|
|
157
|
-
await
|
|
159
|
+
await setTimeout(250);
|
|
158
160
|
const leftColumn = await page.$('#sticky-container');
|
|
159
161
|
const boundingBox = await leftColumn.boundingBox();
|
|
160
162
|
|
|
@@ -14,20 +14,22 @@ const EXAMPLE_TIMEOUT_MODAL_BASIC = {
|
|
|
14
14
|
endWithFullStop: true,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const { setTimeout } = require('node:timers/promises');
|
|
18
|
+
|
|
17
19
|
describe('script: timeout modal', () => {
|
|
18
20
|
describe('when the page loads', () => {
|
|
19
21
|
beforeEach(async () => {
|
|
20
22
|
const component = renderComponent('timeout-modal', { ...EXAMPLE_TIMEOUT_MODAL_BASIC, showModalTimeInSeconds: 58 });
|
|
21
23
|
const template = `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
<div class="ons-page">
|
|
25
|
+
${component}
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
26
28
|
await setTestPage('/test', template);
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
it('displays the modal after the correct number of seconds', async () => {
|
|
30
|
-
await
|
|
32
|
+
await setTimeout(2000);
|
|
31
33
|
const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
|
|
32
34
|
expect(modalIsVisible).toBe(true);
|
|
33
35
|
});
|
|
@@ -42,17 +44,17 @@ describe('script: timeout modal', () => {
|
|
|
42
44
|
});
|
|
43
45
|
|
|
44
46
|
const template = `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
<div class="ons-page">
|
|
48
|
+
${component}
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
49
51
|
|
|
50
52
|
await setTestPage('/test', template);
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
it('shows the time counting down', async () => {
|
|
54
56
|
const timeAtStart = await page.$eval('.ons-js-timeout-timer span', (element) => element.innerHTML);
|
|
55
|
-
await
|
|
57
|
+
await setTimeout(1000);
|
|
56
58
|
const timeAfterOneSecond = await page.$eval('.ons-js-timeout-timer span', (element) => element.innerHTML);
|
|
57
59
|
expect(timeAfterOneSecond).not.toEqual(timeAtStart);
|
|
58
60
|
});
|
|
@@ -70,10 +72,10 @@ describe('script: timeout modal', () => {
|
|
|
70
72
|
});
|
|
71
73
|
|
|
72
74
|
const template = `
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
<div class="ons-page">
|
|
76
|
+
${component}
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
77
79
|
await setTestPage('/test', template);
|
|
78
80
|
});
|
|
79
81
|
|
|
@@ -95,10 +97,10 @@ describe('script: timeout modal', () => {
|
|
|
95
97
|
});
|
|
96
98
|
|
|
97
99
|
const template = `
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
<div class="ons-page">
|
|
101
|
+
${component}
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
102
104
|
await setTestPage('/test', template);
|
|
103
105
|
});
|
|
104
106
|
|
|
@@ -120,10 +122,10 @@ describe('script: timeout modal', () => {
|
|
|
120
122
|
});
|
|
121
123
|
|
|
122
124
|
const template = `
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
<div class="ons-page">
|
|
126
|
+
${component}
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
127
129
|
await setTestPage('/test', template);
|
|
128
130
|
});
|
|
129
131
|
|
|
@@ -145,10 +147,10 @@ describe('script: timeout modal', () => {
|
|
|
145
147
|
});
|
|
146
148
|
|
|
147
149
|
const template = `
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
<div class="ons-page">
|
|
151
|
+
${component}
|
|
152
|
+
</div>
|
|
153
|
+
`;
|
|
152
154
|
await setTestPage('/test', template);
|
|
153
155
|
});
|
|
154
156
|
|
|
@@ -170,10 +172,10 @@ describe('script: timeout modal', () => {
|
|
|
170
172
|
});
|
|
171
173
|
|
|
172
174
|
const template = `
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
<div class="ons-page">
|
|
176
|
+
${component}
|
|
177
|
+
</div>
|
|
178
|
+
`;
|
|
177
179
|
await setTestPage('/test', template);
|
|
178
180
|
});
|
|
179
181
|
|
|
@@ -183,7 +185,7 @@ describe('script: timeout modal', () => {
|
|
|
183
185
|
});
|
|
184
186
|
|
|
185
187
|
it('then redirects to the provided `redirectUrl`', async () => {
|
|
186
|
-
await
|
|
188
|
+
await setTimeout(2000);
|
|
187
189
|
expect(page.url()).toContain('#!');
|
|
188
190
|
});
|
|
189
191
|
});
|
|
@@ -197,10 +199,10 @@ describe('script: timeout modal', () => {
|
|
|
197
199
|
});
|
|
198
200
|
|
|
199
201
|
const template = `
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
<div class="ons-page">
|
|
203
|
+
${component}
|
|
204
|
+
</div>
|
|
205
|
+
`;
|
|
204
206
|
|
|
205
207
|
await setTestPage('/test', template);
|
|
206
208
|
});
|
|
@@ -213,11 +215,14 @@ describe('script: timeout modal', () => {
|
|
|
213
215
|
|
|
214
216
|
it('closes the modal', async () => {
|
|
215
217
|
const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
|
|
218
|
+
|
|
219
|
+
await setTimeout(50);
|
|
220
|
+
|
|
216
221
|
expect(modalIsVisible).toBe(false);
|
|
217
222
|
});
|
|
218
223
|
|
|
219
224
|
it('restarts the timer and displays the modal after the correct number of seconds', async () => {
|
|
220
|
-
await
|
|
225
|
+
await setTimeout(2000);
|
|
221
226
|
const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
|
|
222
227
|
expect(modalIsVisible).toBe(true);
|
|
223
228
|
});
|