fix openDeleteModal with button test

This commit is contained in:
John Mitchell 2019-03-28 10:42:17 -04:00
parent f3a07753e6
commit cc0fd6beb6
No known key found for this signature in database
GPG Key ID: FE6A9B5BD4EB5C94

View File

@ -225,10 +225,12 @@ describe('<DataListToolbar />', () => {
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(
<I18nProvider>
@ -241,12 +243,14 @@ describe('<DataListToolbar />', () => {
onSearch={onSearch}
onSort={onSort}
onSelectAll={onSelectAll}
onOpenDeleteModal={() => {}}
onOpenDeleteModal={onOpenDeleteModal}
showDelete={showDelete}
disableTrashCanIcon={disableTrashCanIcon}
/>
</I18nProvider>
);
toolbar.find(deleteModal).simulate('click');
toolbar.find(openDeleteModalButton).simulate('click');
expect(onOpenDeleteModal).toBeCalled();
});
});