@@ -24,6 +24,12 @@ jest.mock('../../../lib/components/popover/utils/positions', () => {
2424 } ;
2525} ) ;
2626
27+ jest . mock ( '@cloudscape-design/component-toolkit' , ( ) => ( {
28+ ...jest . requireActual ( '@cloudscape-design/component-toolkit' ) ,
29+ // Mock the chart width with enough space to fit all expected elements (labels, x ticks, etc)
30+ useContainerQuery : ( ) => [ 900 , null ] ,
31+ } ) ) ;
32+
2733jest . mock ( '@cloudscape-design/component-toolkit/internal' , ( ) => ( {
2834 ...jest . requireActual ( '@cloudscape-design/component-toolkit/internal' ) ,
2935 getIsRtl : jest . fn ( ) . mockReturnValue ( false ) ,
@@ -113,7 +119,7 @@ const thresholdSeries: MixedLineBarChartProps.ThresholdSeries = {
113119// Transformation to fallback colors for browsers that don't support them are covered by the `parseCssVariable` utility.
114120const originalCSS = window . CSS ;
115121
116- let originalGetComputedStyle : Window [ ' getComputedStyle' ] ;
122+ const originalGetComputedStyle = window . getComputedStyle ;
117123const fakeGetComputedStyle : Window [ 'getComputedStyle' ] = ( ...args ) => {
118124 const result = originalGetComputedStyle ( ...args ) ;
119125 result . borderWidth = '2px' ; // Approximate mock value for the popover body' border width
@@ -124,9 +130,7 @@ const fakeGetComputedStyle: Window['getComputedStyle'] = (...args) => {
124130
125131beforeEach ( ( ) => {
126132 window . CSS . supports = ( ) => true ;
127- originalGetComputedStyle = window . getComputedStyle ;
128133 window . getComputedStyle = fakeGetComputedStyle ;
129-
130134 jest . resetAllMocks ( ) ;
131135} ) ;
132136afterEach ( ( ) => {
0 commit comments