@@ -7,7 +7,7 @@ import TitleLevel from '@ui5/webcomponents/dist/types/TitleLevel.js';
77import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js' ;
88import IllustrationMessageType from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js' ;
99import type { CSSProperties } from 'react' ;
10- import { useEffect , useReducer , useRef , useState } from 'react' ;
10+ import { useEffect , useLayoutEffect , useReducer , useRef , useState } from 'react' ;
1111import type { ObjectPagePropTypes } from '../..' ;
1212import {
1313 CheckBox ,
@@ -45,6 +45,7 @@ import {
4545 ToolbarButton ,
4646} from '../..' ;
4747import { cypressPassThroughTestsFactory } from '@/cypress/support/utils' ;
48+ import type { TabDomRef } from '../../webComponents/Tab/index.js' ;
4849
4950const arbitraryCharsId = `~\`!1@#$%^&*()-_+={}[]:;"'z,<.>/?|♥` ;
5051
@@ -1432,6 +1433,45 @@ describe('ObjectPage', () => {
14321433 cy . get ( 'footer' ) . should ( 'have.attr' , 'role' , 'contentinfo' ) ;
14331434 } ) ;
14341435
1436+ it ( 'tabRef' , ( ) => {
1437+ const TestComp = ( ) => {
1438+ const tabRef = useRef ( null ) ;
1439+
1440+ useLayoutEffect ( ( ) => {
1441+ if ( tabRef . current ) {
1442+ requestAnimationFrame ( ( ) => {
1443+ tabRef . current . getDomRefInStrip ( ) . setAttribute ( 'data-hello' , 'true' ) ;
1444+ } ) ;
1445+ }
1446+ } , [ ] ) ;
1447+
1448+ return (
1449+ < ObjectPage >
1450+ < ObjectPageSection
1451+ id = "0"
1452+ titleText = "callbackRef"
1453+ tabRef = { ( node : TabDomRef | null ) => {
1454+ if ( node ) {
1455+ requestAnimationFrame ( ( ) => {
1456+ node . getDomRefInStrip ( ) . setAttribute ( 'data-hello' , 'true' ) ;
1457+ } ) ;
1458+ }
1459+ } }
1460+ >
1461+ Content
1462+ </ ObjectPageSection >
1463+ < ObjectPageSection id = "1" titleText = "refObject" tabRef = { tabRef } >
1464+ Content
1465+ </ ObjectPageSection >
1466+ </ ObjectPage >
1467+ ) ;
1468+ } ;
1469+
1470+ cy . mount ( < TestComp /> ) ;
1471+
1472+ cy . get ( '[data-hello="true"]' ) . should ( 'be.visible' ) . should ( 'have.length' , 2 ) ;
1473+ } ) ;
1474+
14351475 cypressPassThroughTestsFactory ( ObjectPage ) ;
14361476} ) ;
14371477
0 commit comments