11// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22// SPDX-License-Identifier: Apache-2.0
33import * as React from 'react' ;
4+ import { useLayoutEffect } from 'react' ;
45import { waitFor } from '@testing-library/react' ;
56
67import '../../__a11y__/to-validate-a11y' ;
@@ -11,6 +12,22 @@ import { describeEachAppLayout, renderComponent, testDrawer } from './utils';
1112import mobileStyles from '../../../lib/components/app-layout/mobile-toolbar/styles.css.js' ;
1213import sharedStyles from '../../../lib/components/app-layout/styles.css.js' ;
1314
15+ jest . mock ( '@cloudscape-design/component-toolkit/internal' , ( ) => ( {
16+ ...jest . requireActual ( '@cloudscape-design/component-toolkit/internal' ) ,
17+ useResizeObserver : ( getElement : any , onObserve : any ) => {
18+ useLayoutEffect ( ( ) => {
19+ if ( typeof getElement === 'function' ) {
20+ const element = getElement ( ) ;
21+ if ( element ) {
22+ // Extract height from inline styles for JSDOM compatibility
23+ const height = parseInt ( element . style . height ) || 0 ;
24+ onObserve ( { borderBoxHeight : height } ) ;
25+ }
26+ }
27+ } , [ getElement , onObserve ] ) ;
28+ } ,
29+ } ) ) ;
30+
1431test ( 'does not render mobile mode by default' , ( ) => {
1532 const { wrapper } = renderComponent ( < AppLayout /> ) ;
1633 expect ( wrapper . findByClassName ( mobileStyles [ 'mobile-bar' ] ) ) . toBeFalsy ( ) ;
0 commit comments