@@ -24,6 +24,12 @@ jest.mock('../../../lib/components/popover/utils/positions', () => {
24
24
} ;
25
25
} ) ;
26
26
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
+
27
33
jest . mock ( '@cloudscape-design/component-toolkit/internal' , ( ) => ( {
28
34
...jest . requireActual ( '@cloudscape-design/component-toolkit/internal' ) ,
29
35
getIsRtl : jest . fn ( ) . mockReturnValue ( false ) ,
@@ -113,7 +119,7 @@ const thresholdSeries: MixedLineBarChartProps.ThresholdSeries = {
113
119
// Transformation to fallback colors for browsers that don't support them are covered by the `parseCssVariable` utility.
114
120
const originalCSS = window . CSS ;
115
121
116
- let originalGetComputedStyle : Window [ ' getComputedStyle' ] ;
122
+ const originalGetComputedStyle = window . getComputedStyle ;
117
123
const fakeGetComputedStyle : Window [ 'getComputedStyle' ] = ( ...args ) => {
118
124
const result = originalGetComputedStyle ( ...args ) ;
119
125
result . borderWidth = '2px' ; // Approximate mock value for the popover body' border width
@@ -124,9 +130,7 @@ const fakeGetComputedStyle: Window['getComputedStyle'] = (...args) => {
124
130
125
131
beforeEach ( ( ) => {
126
132
window . CSS . supports = ( ) => true ;
127
- originalGetComputedStyle = window . getComputedStyle ;
128
133
window . getComputedStyle = fakeGetComputedStyle ;
129
-
130
134
jest . resetAllMocks ( ) ;
131
135
} ) ;
132
136
afterEach ( ( ) => {
0 commit comments