@@ -343,7 +343,12 @@ describe('ObjectPage', () => {
343
343
it ( 'scroll to sections - default mode' , ( ) => {
344
344
document . body . style . margin = '0px' ;
345
345
cy . mount (
346
- < ObjectPage titleArea = { DPTitle } headerArea = { DPContent } style = { { height : '100vh' , scrollBehavior : 'auto' } } >
346
+ < ObjectPage
347
+ data-testid = "op"
348
+ titleArea = { DPTitle }
349
+ headerArea = { DPContent }
350
+ style = { { height : '100vh' , scrollBehavior : 'auto' } }
351
+ >
347
352
{ OPContent }
348
353
</ ObjectPage >
349
354
) ;
@@ -362,6 +367,16 @@ describe('ObjectPage', () => {
362
367
cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . realClick ( ) ;
363
368
cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
364
369
370
+ // no scroll when focusing something in the header area
371
+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
372
+ cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
373
+ cy . findByTestId ( 'op' ) . invoke ( 'scrollTop' ) . as ( 'scrollTop' ) ;
374
+ cy . wait ( 100 ) ;
375
+ cy . realPress ( 'ArrowLeft' ) ;
376
+ cy . get ( '@scrollTop' ) . then ( ( scrollTop ) => {
377
+ cy . findByTestId ( 'op' ) . invoke ( 'scrollTop' ) . should ( 'equal' , scrollTop ) ;
378
+ } ) ;
379
+
365
380
cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . focus ( ) ;
366
381
cy . realPress ( 'ArrowDown' ) ;
367
382
cy . realPress ( 'ArrowDown' ) ;
@@ -371,6 +386,7 @@ describe('ObjectPage', () => {
371
386
372
387
cy . mount (
373
388
< ObjectPage
389
+ data-testid
374
390
titleArea = { DPTitle }
375
391
headerArea = { DPContent }
376
392
footerArea = { Footer }
@@ -394,9 +410,10 @@ describe('ObjectPage', () => {
394
410
395
411
cy . wait ( 200 ) ;
396
412
//fallback click
397
- cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . click ( ) ;
413
+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
398
414
cy . findByTestId ( 'footer' ) . should ( 'be.visible' ) ;
399
415
cy . findByText ( 'Employment' ) . should ( 'be.visible' ) ;
416
+ cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
400
417
401
418
cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . click ( ) ;
402
419
cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
@@ -413,12 +430,90 @@ describe('ObjectPage', () => {
413
430
cy . findByText ( 'Job Relationship' ) . should ( 'be.visible' ) ;
414
431
415
432
cy . findByTestId ( 'footer' ) . should ( 'be.visible' ) ;
433
+
434
+ cy . mount (
435
+ < ObjectPage
436
+ data-testid
437
+ titleArea = { DPTitle }
438
+ headerArea = { DPContent }
439
+ footerArea = { Footer }
440
+ style = { { height : '100vh' , scrollBehavior : 'auto' } }
441
+ >
442
+ { OPContent }
443
+ < ObjectPageSection aria-label = "Long Section" id = "long-section" titleText = "Long Section" >
444
+ < ObjectPageSubSection aria-label = "Long Subsection 1" id = "sub1" titleText = "Long Subsection 1" >
445
+ < FlexBox style = { { height : '2000px' } } direction = "Column" justifyContent = "SpaceBetween" >
446
+ < span > Start SubSection1</ span >
447
+ < span > End SubSection1</ span >
448
+ </ FlexBox >
449
+ </ ObjectPageSubSection >
450
+ < ObjectPageSubSection aria-label = "Long Subsection 2" id = "sub2" titleText = "Long Subsection 2" >
451
+ < FlexBox style = { { height : '1000px' } } direction = "Column" justifyContent = "SpaceBetween" >
452
+ < span > Start SubSection2</ span >
453
+ < span > End SubSection2</ span >
454
+ </ FlexBox >
455
+ </ ObjectPageSubSection >
456
+ </ ObjectPageSection >
457
+ </ ObjectPage >
458
+ ) ;
459
+ cy . wait ( 100 ) ;
460
+
461
+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Long Section' ) . focus ( ) ;
462
+ cy . realPress ( 'ArrowDown' ) ;
463
+ cy . get ( '[ui5-responsive-popover]' ) . should ( 'be.visible' ) ;
464
+ cy . realPress ( 'ArrowDown' ) ;
465
+ cy . wait ( 50 ) ;
466
+ cy . realPress ( 'ArrowDown' ) ;
467
+ cy . realPress ( 'Enter' ) ;
468
+ // wait for scroll
469
+ cy . wait ( 200 ) ;
470
+ cy . findByText ( 'Start SubSection2' ) . should ( 'be.visible' ) ;
416
471
} ) ;
417
472
418
473
it ( 'scroll to sections - tab mode' , ( ) => {
419
474
document . body . style . margin = '0px' ;
475
+
420
476
cy . mount (
421
477
< ObjectPage
478
+ data-testid
479
+ titleArea = { DPTitle }
480
+ headerArea = { DPContent }
481
+ footerArea = { Footer }
482
+ style = { { height : '100vh' , scrollBehavior : 'auto' } }
483
+ >
484
+ { OPContent }
485
+ < ObjectPageSection aria-label = "Long Section" id = "long-section" titleText = "Long Section" >
486
+ < ObjectPageSubSection aria-label = "Long Subsection 1" id = "sub1" titleText = "Long Subsection 1" >
487
+ < FlexBox style = { { height : '2000px' } } direction = "Column" justifyContent = "SpaceBetween" >
488
+ < span > Start SubSection1</ span >
489
+ < span > End SubSection1</ span >
490
+ </ FlexBox >
491
+ </ ObjectPageSubSection >
492
+ < ObjectPageSubSection aria-label = "Long Subsection 2" id = "sub2" titleText = "Long Subsection 2" >
493
+ < FlexBox style = { { height : '1000px' } } direction = "Column" justifyContent = "SpaceBetween" >
494
+ < span > Start SubSection2</ span >
495
+ < span > End SubSection2</ span >
496
+ </ FlexBox >
497
+ </ ObjectPageSubSection >
498
+ </ ObjectPageSection >
499
+ </ ObjectPage >
500
+ ) ;
501
+ cy . wait ( 100 ) ;
502
+
503
+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Long Section' ) . focus ( ) ;
504
+ cy . realPress ( 'ArrowDown' ) ;
505
+ cy . get ( '[ui5-responsive-popover]' ) . should ( 'be.visible' ) ;
506
+ cy . realPress ( 'ArrowDown' ) ;
507
+ cy . wait ( 50 ) ;
508
+ cy . realPress ( 'ArrowDown' ) ;
509
+ cy . realPress ( 'Enter' ) ;
510
+ // wait for scroll
511
+ cy . wait ( 200 ) ;
512
+ cy . findByText ( 'Start SubSection2' ) . should ( 'be.visible' ) ;
513
+
514
+ cy . mount (
515
+ < ObjectPage
516
+ data-testid = "op"
422
517
titleArea = { DPTitle }
423
518
headerArea = { DPContent }
424
519
mode = { ObjectPageMode . IconTabBar }
@@ -430,9 +525,16 @@ describe('ObjectPage', () => {
430
525
cy . findByText ( 'Job Information' ) . should ( 'not.exist' ) ;
431
526
cy . findByTestId ( 'section 1' ) . should ( 'be.visible' ) ;
432
527
433
- cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . click ( ) ;
528
+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
434
529
cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
435
530
cy . findByTestId ( 'section 1' ) . should ( 'not.exist' ) ;
531
+ // no scroll when focusing something in the header area
532
+ cy . findByTestId ( 'op' ) . invoke ( 'scrollTop' ) . as ( 'scrollTop' ) ;
533
+ cy . wait ( 100 ) ;
534
+ cy . realPress ( 'ArrowLeft' ) ;
535
+ cy . get ( '@scrollTop' ) . then ( ( scrollTop ) => {
536
+ cy . findByTestId ( 'op' ) . invoke ( 'scrollTop' ) . should ( 'equal' , scrollTop ) ;
537
+ } ) ;
436
538
437
539
cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . click ( ) ;
438
540
cy . findByText ( 'section 2' ) . should ( 'not.exist' ) ;
0 commit comments