@@ -46,6 +46,8 @@ import {
4646} from '../..' ;
4747import { cypressPassThroughTestsFactory } from '@/cypress/support/utils' ;
4848
49+ const arbitraryCharsId = `~\`!1@#$%^&*()-_+={}[]:;"'z,<.>/?|♥` ;
50+
4951describe ( 'ObjectPage' , ( ) => {
5052 [ ObjectPageMode . Default , ObjectPageMode . IconTabBar ] . forEach ( ( mode ) => {
5153 it ( `dynamic children selection (mode: ${ mode } )` , ( ) => {
@@ -360,16 +362,10 @@ describe('ObjectPage', () => {
360362 it ( 'scroll to sections - default mode' , ( ) => {
361363 document . body . style . margin = '0px' ;
362364 cy . mount (
363- < ObjectPage
364- data-testid = "op"
365- titleArea = { DPTitle }
366- headerArea = { DPContent }
367- style = { { height : '100vh' , scrollBehavior : 'auto' } }
368- >
365+ < ObjectPage data-testid = "op" titleArea = { DPTitle } headerArea = { DPContent } style = { { height : '100vh' } } >
369366 { OPContent }
370367 </ ObjectPage > ,
371368 ) ;
372-
373369 cy . wait ( 200 ) ;
374370
375371 // first titleText should never be displayed (not.be.visible doesn't work here - only invisible for sighted users)
@@ -382,6 +378,9 @@ describe('ObjectPage', () => {
382378 cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
383379
384380 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
381+ cy . get ( '[data-section-id="test"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
382+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
383+ cy . get ( `[ui5-tab][data-index="3"]` ) . should ( 'have.attr' , 'selected' ) ;
385384 cy . findByText ( 'Employment' ) . should ( 'be.visible' ) ;
386385
387386 cy . wait ( 200 ) ;
@@ -404,6 +403,8 @@ describe('ObjectPage', () => {
404403 cy . realPress ( 'ArrowDown' ) ;
405404 cy . realPress ( 'ArrowDown' ) ;
406405 cy . realPress ( 'Enter' ) ;
406+ cy . get ( '[data-section-id="goals"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
407+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
407408 cy . findByText ( 'Job Relationship' ) . should ( 'be.visible' ) ;
408409
409410 cy . mount (
@@ -412,7 +413,7 @@ describe('ObjectPage', () => {
412413 titleArea = { DPTitle }
413414 headerArea = { DPContent }
414415 footerArea = { Footer }
415- style = { { height : '100vh' , scrollBehavior : 'auto' } }
416+ style = { { height : '100vh' } }
416417 >
417418 { OPContent }
418419 </ ObjectPage > ,
@@ -433,11 +434,15 @@ describe('ObjectPage', () => {
433434 cy . wait ( 200 ) ;
434435 //fallback click
435436 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Employment' ) . realClick ( ) ;
437+ cy . get ( '[data-section-id="test"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
438+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
436439 cy . findByTestId ( 'footer' ) . should ( 'be.visible' ) ;
437440 cy . findByText ( 'Employment' ) . should ( 'be.visible' ) ;
438441 cy . findByText ( 'Job Information' ) . should ( 'be.visible' ) ;
439442
440443 cy . get ( '[ui5-tabcontainer]' ) . findUi5TabByText ( 'Goals' ) . click ( ) ;
444+ cy . get ( '[data-section-id="test"]' ) . shouldNeverHaveAttribute ( 'selected' , 300 ) ;
445+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
441446 cy . findByText ( 'Test' ) . should ( 'be.visible' ) ;
442447 cy . findByTestId ( 'footer' ) . should ( 'be.visible' ) ;
443448
@@ -447,6 +452,8 @@ describe('ObjectPage', () => {
447452 cy . realPress ( 'ArrowDown' ) ;
448453 cy . realPress ( 'ArrowDown' ) ;
449454 cy . realPress ( 'Enter' ) ;
455+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
456+ cy . get ( `[ui5-tab][data-index="3"]` ) . should ( 'have.attr' , 'selected' ) ;
450457 // wait for scroll
451458 cy . wait ( 200 ) ;
452459 cy . findByText ( 'Job Relationship' ) . should ( 'be.visible' ) ;
@@ -459,7 +466,7 @@ describe('ObjectPage', () => {
459466 titleArea = { DPTitle }
460467 headerArea = { DPContent }
461468 footerArea = { Footer }
462- style = { { height : '100vh' , scrollBehavior : 'auto' } }
469+ style = { { height : '100vh' } }
463470 >
464471 { OPContent }
465472 < ObjectPageSection aria-label = "Long Section" id = "long-section" titleText = "Long Section" >
@@ -487,6 +494,9 @@ describe('ObjectPage', () => {
487494 cy . wait ( 50 ) ;
488495 cy . realPress ( 'ArrowDown' ) ;
489496 cy . realPress ( 'Enter' ) ;
497+ cy . get ( '[data-section-id="test"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
498+ cy . get ( '[data-section-id="personal"]' ) . shouldNeverHaveAttribute ( 'selected' ) ;
499+ cy . get ( `[ui5-tab][data-index="3"]` ) . shouldNeverHaveAttribute ( 'selected' ) ;
490500 // wait for scroll
491501 cy . wait ( 200 ) ;
492502 cy . findByText ( 'Start SubSection2' ) . should ( 'be.visible' ) ;
@@ -501,7 +511,7 @@ describe('ObjectPage', () => {
501511 titleArea = { DPTitle }
502512 headerArea = { DPContent }
503513 footerArea = { Footer }
504- style = { { height : '100vh' , scrollBehavior : 'auto' } }
514+ style = { { height : '100vh' } }
505515 >
506516 { OPContent }
507517 < ObjectPageSection aria-label = "Long Section" id = "long-section" titleText = "Long Section" >
@@ -1164,7 +1174,7 @@ describe('ObjectPage', () => {
11641174 . its ( 'secondCall.args[0].detail' )
11651175 . should ( 'deep.equal' , {
11661176 sectionIndex : 3 ,
1167- sectionId : `~\`!1@#$%^&*()-_+={}[]:;"'z,<.>/?|♥` ,
1177+ sectionId : arbitraryCharsId ,
11681178 subSectionId : 'employment-job-information' ,
11691179 } ) ;
11701180 cy . get ( '@sectionChangeSpy' ) . should ( 'not.have.been.called' ) ;
@@ -1505,7 +1515,7 @@ const OPContent = [
15051515 </ div >
15061516 </ ObjectPageSubSection >
15071517 </ ObjectPageSection > ,
1508- < ObjectPageSection key = "3" titleText = "Employment" id = { `~\`!1@#$%^&*()-_+={}[]:;"'z,<.>/?|♥` } aria-label = "Employment" >
1518+ < ObjectPageSection key = "3" titleText = "Employment" id = { arbitraryCharsId } aria-label = "Employment" >
15091519 < ObjectPageSubSection titleText = "Job Information" id = "employment-job-information" aria-label = "Job Information" >
15101520 < div style = { { height : '100px' , width : '100%' , background : 'orange' } } >
15111521 < span data-testid = "employment-job-information-content" > employment-job-information-content</ span >
0 commit comments