From cc0fd6beb6dff9494f8a1f7a801cc2f1aa96f725 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 28 Mar 2019 10:42:17 -0400 Subject: [PATCH] fix openDeleteModal with button test --- __tests__/components/DataListToolbar.test.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/__tests__/components/DataListToolbar.test.jsx b/__tests__/components/DataListToolbar.test.jsx index b07c4fb5e8..6567e21a05 100644 --- a/__tests__/components/DataListToolbar.test.jsx +++ b/__tests__/components/DataListToolbar.test.jsx @@ -225,10 +225,12 @@ describe('', () => { test('trash can button triggers correct function', () => { const columns = [{ name: 'Name', key: 'name', isSortable: true }]; const onOpenDeleteModal = jest.fn(); - const deleteModal = 'button.pf-c-button.pf-m-plain.awx-ToolBarBtn'; + const openDeleteModalButton = 'button[aria-label="Delete"]'; const onSearch = jest.fn(); const onSort = jest.fn(); const onSelectAll = jest.fn(); + const showDelete = true; + const disableTrashCanIcon = false; toolbar = mount( @@ -241,12 +243,14 @@ describe('', () => { onSearch={onSearch} onSort={onSort} onSelectAll={onSelectAll} - onOpenDeleteModal={() => {}} + onOpenDeleteModal={onOpenDeleteModal} + showDelete={showDelete} + disableTrashCanIcon={disableTrashCanIcon} /> ); - toolbar.find(deleteModal).simulate('click'); + toolbar.find(openDeleteModalButton).simulate('click'); expect(onOpenDeleteModal).toBeCalled(); }); });