@@ -343,7 +343,12 @@ describe('ObjectPage', () => {
343343 it ( 'scroll to sections - default mode' , ( ) => {
344344 document . body . style . margin = '0px' ;
345345 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+ >
347352 { OPContent }
348353 </ ObjectPage >
349354 ) ;
@@ -362,6 +367,16 @@ describe('ObjectPage', () => {
362367 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . realClick ( ) ;
363368 cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
364369
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+
365380 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . focus ( ) ;
366381 cy . realPress ( 'ArrowDown' ) ;
367382 cy . realPress ( 'ArrowDown' ) ;
@@ -371,6 +386,7 @@ describe('ObjectPage', () => {
371386
372387 cy . mount (
373388 < ObjectPage
389+ data-testid
374390 titleArea = { DPTitle }
375391 headerArea = { DPContent }
376392 footerArea = { Footer }
@@ -394,9 +410,10 @@ describe('ObjectPage', () => {
394410
395411 cy . wait ( 200 ) ;
396412 //fallback click
397- cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . click ( ) ;
413+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
398414 cy . findByTestId ( 'footer' ) . should ( 'be.visible' ) ;
399415 cy . findByText ( 'Employment' ) . should ( 'be.visible' ) ;
416+ cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
400417
401418 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . click ( ) ;
402419 cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
@@ -413,12 +430,90 @@ describe('ObjectPage', () => {
413430 cy . findByText ( 'Job Relationship' ) . should ( 'be.visible' ) ;
414431
415432 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' ) ;
416471 } ) ;
417472
418473 it ( 'scroll to sections - tab mode' , ( ) => {
419474 document . body . style . margin = '0px' ;
475+
420476 cy . mount (
421477 < 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"
422517 titleArea = { DPTitle }
423518 headerArea = { DPContent }
424519 mode = { ObjectPageMode . IconTabBar }
@@ -430,9 +525,16 @@ describe('ObjectPage', () => {
430525 cy . findByText ( 'Job Information' ) . should ( 'not.exist' ) ;
431526 cy . findByTestId ( 'section 1' ) . should ( 'be.visible' ) ;
432527
433- cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . click ( ) ;
528+ cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
434529 cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
435530 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+ } ) ;
436538
437539 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . click ( ) ;
438540 cy . findByText ( 'section 2' ) . should ( 'not.exist' ) ;
0 commit comments