Skip to content

Commit 22d967b

Browse files
committed
test: add test to library collection card click
1 parent 9bf728c commit 22d967b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/library-authoring/LibraryAuthoringPage.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,25 @@ describe('<LibraryAuthoringPage />', () => {
458458
await waitFor(() => expect(screen.queryByTestId('library-sidebar')).not.toBeInTheDocument());
459459
});
460460

461+
it('should open and close the collection sidebar', async () => {
462+
const displayName = 'Collection 1';
463+
await renderLibraryPage();
464+
465+
// Click on the first component. It could appear twice, in both "Recently Modified" and "Collections"
466+
fireEvent.click((await screen.findAllByText(displayName))[0]);
467+
468+
const sidebar = screen.getByTestId('library-sidebar');
469+
470+
const { getByRole, getByText } = within(sidebar);
471+
472+
await waitFor(() => expect(getByText(displayName)).toBeInTheDocument());
473+
474+
const closeButton = getByRole('button', { name: /close/i });
475+
fireEvent.click(closeButton);
476+
477+
await waitFor(() => expect(screen.queryByTestId('library-sidebar')).not.toBeInTheDocument());
478+
});
479+
461480
it('can filter by capa problem type', async () => {
462481
const problemTypes = {
463482
'Multiple Choice': 'choiceresponse',

0 commit comments

Comments
 (0)