test: fix SettingsObjectDisabledMenuDropDown storybook tests (#2257)
* test: fix SettingsObjectDisabledMenuDropDown storybook tests * fix: fix BoardOptionsDropdownContent lint error
This commit is contained in:
@ -37,11 +37,11 @@ type Story = StoryObj<typeof SettingsObjectDisabledMenuDropDown>;
|
|||||||
|
|
||||||
export const Default: Story = {};
|
export const Default: Story = {};
|
||||||
|
|
||||||
export const WithOpen: Story = {
|
export const Open: Story = {
|
||||||
play: async ({ canvasElement }) => {
|
play: async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
const dropdownButton = await canvas.findByRole('button');
|
const dropdownButton = await canvas.getByRole('button');
|
||||||
|
|
||||||
await userEvent.click(dropdownButton);
|
await userEvent.click(dropdownButton);
|
||||||
},
|
},
|
||||||
@ -51,34 +51,39 @@ export const WithActivate: Story = {
|
|||||||
play: async ({ canvasElement }) => {
|
play: async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
const dropdownButton = await canvas.findByRole('button');
|
const dropdownButton = await canvas.getByRole('button');
|
||||||
|
|
||||||
await userEvent.click(dropdownButton);
|
await userEvent.click(dropdownButton);
|
||||||
|
|
||||||
await expect(handleActivateMockFunction).toHaveBeenCalledTimes(0);
|
await expect(handleActivateMockFunction).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
const activateMenuItem = await canvas.findByText('Activate');
|
const activateMenuItem = await canvas.getByText('Activate');
|
||||||
|
|
||||||
await userEvent.click(activateMenuItem);
|
await userEvent.click(activateMenuItem);
|
||||||
|
|
||||||
await expect(handleActivateMockFunction).toHaveBeenCalledTimes(1);
|
await expect(handleActivateMockFunction).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
|
await userEvent.click(dropdownButton);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithErase: Story = {
|
export const WithErase: Story = {
|
||||||
|
args: { isCustomObject: true },
|
||||||
play: async ({ canvasElement }) => {
|
play: async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
const dropdownButton = await canvas.findByRole('button');
|
const dropdownButton = await canvas.getByRole('button');
|
||||||
|
|
||||||
await userEvent.click(dropdownButton);
|
await userEvent.click(dropdownButton);
|
||||||
|
|
||||||
await expect(handleEraseMockFunction).toHaveBeenCalledTimes(0);
|
await expect(handleEraseMockFunction).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
const eraseMenuItem = await canvas.findByText('Erase');
|
const eraseMenuItem = await canvas.getByText('Erase');
|
||||||
|
|
||||||
await userEvent.click(eraseMenuItem);
|
await userEvent.click(eraseMenuItem);
|
||||||
|
|
||||||
await expect(handleEraseMockFunction).toHaveBeenCalledTimes(1);
|
await expect(handleEraseMockFunction).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
|
await userEvent.click(dropdownButton);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user