Skip to content

Commit

Permalink
fix: Adds overflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie George committed Aug 7, 2023
1 parent 180c033 commit b7c98e2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app-layout/__tests__/drawers.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import { describeEachAppLayout, renderComponent, singleDrawer, defineClientHeight } from './utils';
import { describeEachAppLayout, renderComponent, singleDrawer, defineClientHeight, manyDrawers } from './utils';
import { act, screen } from '@testing-library/react';
import AppLayout from '../../../lib/components/app-layout';

jest.mock('../../../lib/components/internal/hooks/use-mobile', () => ({
Expand Down Expand Up @@ -29,4 +30,12 @@ describeEachAppLayout(() => {

expect(wrapper.findDrawersTriggers()!).toHaveLength(0);
});

test('should open active drawer on click of overflow item', () => {
const { wrapper } = renderComponent(<AppLayout contentType="form" {...manyDrawers} />);
expect(wrapper.findActiveDrawer()).toBeFalsy();
act(() => screen.getByLabelText('Overflow drawer triggers').click());
act(() => screen.getAllByRole('menuitem')[0].click());
expect(wrapper.findActiveDrawer()).toBeTruthy();
});
});

0 comments on commit b7c98e2

Please sign in to comment.