Skip to content

Commit

Permalink
Add some more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondyr committed Jan 14, 2025
1 parent c1036e8 commit 8198f2d
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,39 @@ describe('Summary2Override', () => {
),
);
});

it('should show info message when hideEmptyFields is true', async () => {
render({ overrides: [{ componentId: '1', hideEmptyFields: true }] });
await userEvent.click(overrideCollapsedButton(1));
expect(
screen.getByText(
textMock('ux_editor.component_properties.summary.override.hide_empty_fields.info_message'),
),
).toBeInTheDocument();
});

it('should collapse and uncollapse override', async () => {
render({ overrides: [{ componentId: '1' }] });
await userEvent.click(overrideCollapsedButton(1));
expect(
screen.queryByRole('button', {
name: textMock('ux_editor.component_properties.summary.overrides.nth.*:1}'),
}),
).not.toBeInTheDocument();
await userEvent.click(overrideCloseButton());
expect(
screen.queryByRole('button', {
name: textMock('ux_editor.component_properties.summary.overrides.nth.*:1}'),
}),
).not.toBeInTheDocument();
});
});

const overrideCloseButton = () =>
screen.getByRole('button', {
name: /general.save/i,
});

const overrideCollapsedButton = (n: number) =>
screen.getByRole('button', {
name: new RegExp(`ux_editor.component_properties.summary.overrides.nth.*:${n}}`),
Expand Down

0 comments on commit 8198f2d

Please sign in to comment.