Skip to content

Commit b588832

Browse files
committed
fix: main.test.tsx
1 parent 07cb663 commit b588832

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/app-layout/__tests__/main.test.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ describeEachAppLayout({ themes: ['classic', 'refresh-toolbar'], sizes: ['desktop
7676
const findToggle = (wrapper: AppLayoutWrapper) => wrapper.findDrawersTriggers()![0];
7777
const findClose = (wrapper: AppLayoutWrapper) => wrapper.findActiveDrawerCloseButton()!;
7878

79-
test('property is controlled', () => {
79+
test('property is controlled', async () => {
8080
const onChange = jest.fn();
8181
const { wrapper, rerender } = renderComponent(
8282
<AppLayout activeDrawerId={null} onDrawerChange={event => onChange(event.detail)} drawers={[testDrawer]} />
8383
);
8484

85-
expect(findElement(wrapper)).toBeNull();
86-
findToggle(wrapper).click();
87-
expect(onChange).toHaveBeenCalledWith({ activeDrawerId: 'security' });
85+
await waitFor(() => {
86+
expect(findElement(wrapper)).toBeNull();
87+
findToggle(wrapper).click();
88+
expect(onChange).toHaveBeenCalledWith({ activeDrawerId: 'security' });
89+
});
8890

8991
rerender(
9092
<AppLayout
@@ -101,9 +103,11 @@ describeEachAppLayout({ themes: ['classic', 'refresh-toolbar'], sizes: ['desktop
101103
});
102104

103105
describe('Content height calculation', () => {
104-
test('should take the full page height by default', () => {
106+
test('should take the full page height by default', async () => {
105107
const { wrapper } = renderComponent(<AppLayout />);
106-
expect(wrapper.getElement()).toHaveStyle({ minBlockSize: 'calc(100vh - 0px)' });
108+
await waitFor(() => {
109+
expect(wrapper.getElement()).toHaveStyle({ minBlockSize: 'calc(100vh - 0px)' });
110+
});
107111
});
108112

109113
test('should include header and footer in the calculation', async () => {

0 commit comments

Comments
 (0)