fix openDeleteModal with button test

This commit is contained in:
John Mitchell
2019-03-28 10:42:17 -04:00
parent f3a07753e6
commit cc0fd6beb6

View File

@@ -225,10 +225,12 @@ describe('<DataListToolbar />', () => {
test('trash can button triggers correct function', () => { test('trash can button triggers correct function', () => {
const columns = [{ name: 'Name', key: 'name', isSortable: true }]; const columns = [{ name: 'Name', key: 'name', isSortable: true }];
const onOpenDeleteModal = jest.fn(); 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 onSearch = jest.fn();
const onSort = jest.fn(); const onSort = jest.fn();
const onSelectAll = jest.fn(); const onSelectAll = jest.fn();
const showDelete = true;
const disableTrashCanIcon = false;
toolbar = mount( toolbar = mount(
<I18nProvider> <I18nProvider>
@@ -241,12 +243,14 @@ describe('<DataListToolbar />', () => {
onSearch={onSearch} onSearch={onSearch}
onSort={onSort} onSort={onSort}
onSelectAll={onSelectAll} onSelectAll={onSelectAll}
onOpenDeleteModal={() => {}} onOpenDeleteModal={onOpenDeleteModal}
showDelete={showDelete}
disableTrashCanIcon={disableTrashCanIcon}
/> />
</I18nProvider> </I18nProvider>
); );
toolbar.find(deleteModal).simulate('click'); toolbar.find(openDeleteModalButton).simulate('click');
expect(onOpenDeleteModal).toBeCalled(); expect(onOpenDeleteModal).toBeCalled();
}); });
}); });