From b7c98e20703c1edd38e1af0264d9576ff8a887ab Mon Sep 17 00:00:00 2001 From: Katie George Date: Mon, 7 Aug 2023 15:26:50 -0700 Subject: [PATCH] fix: Adds overflow test --- src/app-layout/__tests__/drawers.test.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app-layout/__tests__/drawers.test.tsx b/src/app-layout/__tests__/drawers.test.tsx index 40e2db5c5c..637bc122ec 100644 --- a/src/app-layout/__tests__/drawers.test.tsx +++ b/src/app-layout/__tests__/drawers.test.tsx @@ -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', () => ({ @@ -29,4 +30,12 @@ describeEachAppLayout(() => { expect(wrapper.findDrawersTriggers()!).toHaveLength(0); }); + + test('should open active drawer on click of overflow item', () => { + const { wrapper } = renderComponent(); + expect(wrapper.findActiveDrawer()).toBeFalsy(); + act(() => screen.getByLabelText('Overflow drawer triggers').click()); + act(() => screen.getAllByRole('menuitem')[0].click()); + expect(wrapper.findActiveDrawer()).toBeTruthy(); + }); });