Skip to content

Commit

Permalink
Update tests and remove unused export.
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad-Simso committed Oct 30, 2024
1 parent c950bab commit da9ef74
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ describe('CodeListTableEditor', () => {
it('should open Dialog', async () => {
const user = userEvent.setup();
await renderCodeListTableEditor();
await userFindOpenButtonAndClick(user);
await openModal(user);

expect(screen.getByRole('dialog')).toBeInTheDocument();
});

it('should close Dialog', async () => {
const user = userEvent.setup();
await renderCodeListTableEditor();
await userFindOpenButtonAndClick(user);
await openModal(user);

await user.click(screen.getByRole('button', { name: 'close modal' })); // Todo: Replace "close modal" with defaultDialogProps.closeButtonTitle when https://github.com/digdir/designsystemet/issues/2195 is fixed

Expand All @@ -66,7 +66,7 @@ describe('CodeListTableEditor', () => {
const user = userEvent.setup();
const doReloadPreview = jest.fn();
await renderCodeListTableEditor({ previewContextProps: { doReloadPreview } });
await userFindOpenButtonAndClick(user);
await openModal(user);

await user.click(screen.getByRole('button', { name: 'close modal' })); // Todo: Replace "close modal" with defaultDialogProps.closeButtonTitle when https://github.com/digdir/designsystemet/issues/2195 is fixed

Expand All @@ -75,7 +75,7 @@ describe('CodeListTableEditor', () => {
});
});

const userFindOpenButtonAndClick = async (user: UserEvent) => {
const openModal = async (user: UserEvent) => {
const btnOpen = await screen.findByRole('button', {
name: textMock('ux_editor.modal_properties_code_list_open_editor'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import { useCodeListEditorTexts } from './hooks/useCodeListEditorTexts';
import { usePreviewContext } from 'app-development/contexts/PreviewContext';
import classes from './CodeListTableEditor.module.css';

export type CodeListTableEditorProps = Pick<
IGenericEditComponent<SelectionComponentType>,
'component'
>;
type CodeListTableEditorProps = Pick<IGenericEditComponent<SelectionComponentType>, 'component'>;

export function CodeListTableEditor({ component }: CodeListTableEditorProps): React.ReactNode {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('conversionUtils', () => {
});

it('should return converted list', () => {
expect(convertOptionsListToCodeListItemList(optionsList)).toEqual(codeListItemList);
expect(convertOptionsListToCodeListItemList(optionsList)).toStrictEqual(codeListItemList);
});
});

Expand All @@ -38,7 +38,7 @@ describe('conversionUtils', () => {
});

it('should return converted list', () => {
expect(convertCodeListItemListToOptionsList(codeListItemList)).toEqual(optionsList);
expect(convertCodeListItemListToOptionsList(codeListItemList)).toStrictEqual(optionsList);
});
});
});

0 comments on commit da9ef74

Please sign in to comment.