mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 16:58:46 -03:30
fix openDeleteModal with button test
This commit is contained in:
@@ -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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user