mirror of
https://github.com/apache/superset.git
synced 2026-07-09 08:15:49 +00:00
test: Fix act errors in DndColumnSelectControl tests (#22068)
This commit is contained in:
@@ -21,7 +21,7 @@ import { render, screen, fireEvent } from 'spec/helpers/testing-library';
|
||||
import { DndItemType } from 'src/explore/components/DndItemType';
|
||||
import OptionWrapper from 'src/explore/components/controls/DndColumnSelectControl/OptionWrapper';
|
||||
|
||||
test('renders with default props', () => {
|
||||
test('renders with default props', async () => {
|
||||
const { container } = render(
|
||||
<OptionWrapper
|
||||
index={1}
|
||||
@@ -33,10 +33,12 @@ test('renders with default props', () => {
|
||||
{ useDnd: true },
|
||||
);
|
||||
expect(container).toBeInTheDocument();
|
||||
expect(screen.getByRole('img', { name: 'x-small' })).toBeInTheDocument();
|
||||
expect(
|
||||
await screen.findByRole('img', { name: 'x-small' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('triggers onShiftOptions on drop', () => {
|
||||
test('triggers onShiftOptions on drop', async () => {
|
||||
const onShiftOptions = jest.fn();
|
||||
render(
|
||||
<>
|
||||
@@ -58,7 +60,7 @@ test('triggers onShiftOptions on drop', () => {
|
||||
{ useDnd: true },
|
||||
);
|
||||
|
||||
fireEvent.dragStart(screen.getByText('Option 1'));
|
||||
fireEvent.drop(screen.getByText('Option 2'));
|
||||
fireEvent.dragStart(await screen.findByText('Option 1'));
|
||||
fireEvent.drop(await screen.findByText('Option 2'));
|
||||
expect(onShiftOptions).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user