@@ -88,9 +88,7 @@ describe('dashboard - keyboard interaction', () => {
88
88
await sendKeys ( { press : 'Space' } ) ;
89
89
90
90
// Focus the focus-button with shift + tab
91
- await sendKeys ( { down : 'Shift' } ) ;
92
- await sendKeys ( { press : 'Tab' } ) ;
93
- await sendKeys ( { up : 'Shift' } ) ;
91
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
94
92
95
93
// Click the focus-button
96
94
await sendKeys ( { press : 'Space' } ) ;
@@ -158,9 +156,7 @@ describe('dashboard - keyboard interaction', () => {
158
156
it ( 'should blur deselected widget on shift tab' , async ( ) => {
159
157
const widget = getElementFromCell ( dashboard , 0 , 0 ) ! ;
160
158
await sendKeys ( { press : 'Escape' } ) ;
161
- await sendKeys ( { down : 'Shift' } ) ;
162
- await sendKeys ( { press : 'Tab' } ) ;
163
- await sendKeys ( { up : 'Shift' } ) ;
159
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
164
160
expect ( widget . hasAttribute ( 'selected' ) ) . to . be . false ;
165
161
expect ( widget . hasAttribute ( 'focused' ) ) . to . be . false ;
166
162
expect ( widget . contains ( document . activeElement ) ) . to . be . false ;
@@ -233,29 +229,23 @@ describe('dashboard - keyboard interaction', () => {
233
229
it ( 'should increase the widget row span on shift + arrow down' , async ( ) => {
234
230
// Set minimum row height to enable vertical resizing
235
231
setMinimumRowHeight ( dashboard , 100 ) ;
236
- await sendKeys ( { down : 'Shift' } ) ;
237
- await sendKeys ( { press : 'ArrowDown' } ) ;
238
- await sendKeys ( { up : 'Shift' } ) ;
232
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
239
233
expect ( ( dashboard . items [ 0 ] as DashboardItem ) . rowspan ) . to . equal ( 2 ) ;
240
234
} ) ;
241
235
242
236
it ( 'should decrease the widget row span on shift + arrow up' , async ( ) => {
243
237
// Set minimum row height to enable vertical resizing
244
238
setMinimumRowHeight ( dashboard , 100 ) ;
245
- await sendKeys ( { down : 'Shift' } ) ;
246
- await sendKeys ( { press : 'ArrowDown' } ) ;
239
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
247
240
await updateComplete ( dashboard ) ;
248
- await sendKeys ( { press : 'ArrowUp' } ) ;
249
- await sendKeys ( { up : 'Shift' } ) ;
241
+ await sendKeys ( { press : 'Shift+ArrowUp' } ) ;
250
242
expect ( ( dashboard . items [ 0 ] as DashboardItem ) . rowspan ) . to . equal ( 1 ) ;
251
243
} ) ;
252
244
253
245
it ( 'should dispatch an item resized event shift + arrow down' , async ( ) => {
254
246
const spy = sinon . spy ( ) ;
255
247
dashboard . addEventListener ( 'dashboard-item-resized' , spy ) ;
256
- await sendKeys ( { down : 'Shift' } ) ;
257
- await sendKeys ( { press : 'ArrowDown' } ) ;
258
- await sendKeys ( { up : 'Shift' } ) ;
248
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
259
249
expect ( spy . calledOnce ) . to . be . true ;
260
250
expect ( spy . firstCall . args [ 0 ] . detail . item ) . to . eql ( { id : 0 } ) ;
261
251
expect ( spy . firstCall . args [ 0 ] . detail . items ) . to . eql ( dashboard . items ) ;
@@ -266,23 +256,17 @@ describe('dashboard - keyboard interaction', () => {
266
256
const spy = sinon . spy ( ) ;
267
257
// @ts -ignore unexpected event type
268
258
dashboard . addEventListener ( 'item-resize' , spy ) ;
269
- await sendKeys ( { down : 'Shift' } ) ;
270
- await sendKeys ( { press : 'ArrowDown' } ) ;
271
- await sendKeys ( { up : 'Shift' } ) ;
259
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
272
260
expect ( spy . called ) . to . be . false ;
273
261
} ) ;
274
262
275
263
it ( 'should not increase the widget row span on shift + arrow down if row min height is not defined' , async ( ) => {
276
- await sendKeys ( { down : 'Shift' } ) ;
277
- await sendKeys ( { press : 'ArrowDown' } ) ;
278
- await sendKeys ( { up : 'Shift' } ) ;
264
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
279
265
expect ( ( dashboard . items [ 0 ] as DashboardItem ) . rowspan ) . to . not . equal ( 2 ) ;
280
266
} ) ;
281
267
282
268
it ( 'should not move the widget on arrow down if ctrl key is pressed' , async ( ) => {
283
- await sendKeys ( { down : 'Control' } ) ;
284
- await sendKeys ( { press : 'ArrowDown' } ) ;
285
- await sendKeys ( { up : 'Control' } ) ;
269
+ await sendKeys ( { press : 'Control+ArrowDown' } ) ;
286
270
expect ( dashboard . items ) . to . eql ( [ { id : 0 } , { id : 1 } , { items : [ { id : 2 } , { id : 3 } ] } ] ) ;
287
271
} ) ;
288
272
@@ -341,9 +325,7 @@ describe('dashboard - keyboard interaction', () => {
341
325
it ( 'should release focus trap on deselect' , async ( ) => {
342
326
const widget = getElementFromCell ( dashboard , 0 , 0 ) ! ;
343
327
await sendKeys ( { press : 'Escape' } ) ;
344
- await sendKeys ( { down : 'Shift' } ) ;
345
- await sendKeys ( { press : 'Tab' } ) ;
346
- await sendKeys ( { up : 'Shift' } ) ;
328
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
347
329
expect ( widget . contains ( document . activeElement ) ) . to . be . false ;
348
330
} ) ;
349
331
@@ -369,18 +351,14 @@ describe('dashboard - keyboard interaction', () => {
369
351
} ) ;
370
352
371
353
it ( 'should increase the widget column span on shift + arrow forwards' , async ( ) => {
372
- await sendKeys ( { down : 'Shift' } ) ;
373
- await sendKeys ( { press : arrowForwards } ) ;
374
- await sendKeys ( { up : 'Shift' } ) ;
354
+ await sendKeys ( { press : `Shift+${ arrowForwards } ` } ) ;
375
355
expect ( ( dashboard . items [ 0 ] as DashboardItem ) . colspan ) . to . equal ( 2 ) ;
376
356
} ) ;
377
357
378
358
it ( 'should decrease the widget column span on shift + arrow backwards' , async ( ) => {
379
- await sendKeys ( { down : 'Shift' } ) ;
380
- await sendKeys ( { press : arrowForwards } ) ;
359
+ await sendKeys ( { press : `Shift+${ arrowForwards } ` } ) ;
381
360
await updateComplete ( dashboard ) ;
382
- await sendKeys ( { press : arrowBackwards } ) ;
383
- await sendKeys ( { up : 'Shift' } ) ;
361
+ await sendKeys ( { press : `Shift+${ arrowBackwards } ` } ) ;
384
362
expect ( ( dashboard . items [ 0 ] as DashboardItem ) . colspan ) . to . equal ( 1 ) ;
385
363
} ) ;
386
364
} ) ;
@@ -412,9 +390,7 @@ describe('dashboard - keyboard interaction', () => {
412
390
413
391
it ( 'should blur deselected selected on shift tab' , async ( ) => {
414
392
await sendKeys ( { press : 'Escape' } ) ;
415
- await sendKeys ( { down : 'Shift' } ) ;
416
- await sendKeys ( { press : 'Tab' } ) ;
417
- await sendKeys ( { up : 'Shift' } ) ;
393
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
418
394
expect ( section . hasAttribute ( 'selected' ) ) . to . be . false ;
419
395
expect ( section . hasAttribute ( 'focused' ) ) . to . be . false ;
420
396
expect ( section . contains ( document . activeElement ) ) . to . be . false ;
@@ -446,16 +422,12 @@ describe('dashboard - keyboard interaction', () => {
446
422
447
423
it ( 'should release focus trap on deselect' , async ( ) => {
448
424
await sendKeys ( { press : 'Escape' } ) ;
449
- await sendKeys ( { down : 'Shift' } ) ;
450
- await sendKeys ( { press : 'Tab' } ) ;
451
- await sendKeys ( { up : 'Shift' } ) ;
425
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
452
426
expect ( section . contains ( document . activeElement ) ) . to . be . false ;
453
427
} ) ;
454
428
455
429
it ( 'should not increase the section row span on shift + arrow down' , async ( ) => {
456
- await sendKeys ( { down : 'Shift' } ) ;
457
- await sendKeys ( { press : 'ArrowDown' } ) ;
458
- await sendKeys ( { up : 'Shift' } ) ;
430
+ await sendKeys ( { press : 'Shift+ArrowDown' } ) ;
459
431
expect ( dashboard . items ) . to . eql ( [ { id : 0 } , { id : 1 } , { items : [ { id : 2 } , { id : 3 } ] } ] ) ;
460
432
} ) ;
461
433
} ) ;
@@ -565,10 +537,8 @@ describe('dashboard - keyboard interaction', () => {
565
537
await sendKeys ( { press : 'Space' } ) ;
566
538
await nextFrame ( ) ;
567
539
// Focus backward button, click it
568
- await sendKeys ( { down : 'Shift' } ) ;
569
- await sendKeys ( { press : 'Tab' } ) ;
570
- await sendKeys ( { press : 'Tab' } ) ;
571
- await sendKeys ( { up : 'Shift' } ) ;
540
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
541
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
572
542
await nextFrame ( ) ;
573
543
574
544
expect ( getMoveBackwardButton ( widget ) . matches ( ':focus' ) ) . to . be . true ;
@@ -598,10 +568,8 @@ describe('dashboard - keyboard interaction', () => {
598
568
await sendKeys ( { press : 'Space' } ) ;
599
569
await nextFrame ( ) ;
600
570
// Focus backwards button, click it
601
- await sendKeys ( { down : 'Shift' } ) ;
602
- await sendKeys ( { press : 'Tab' } ) ;
603
- await sendKeys ( { press : 'Tab' } ) ;
604
- await sendKeys ( { up : 'Shift' } ) ;
571
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
572
+ await sendKeys ( { press : 'Shift+Tab' } ) ;
605
573
await sendKeys ( { press : 'Space' } ) ;
606
574
await nextFrame ( ) ;
607
575
0 commit comments