Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lotorvik committed May 14, 2024
1 parent 74690ce commit 0714f27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/fyllut/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ httpFyllut
const renderReact = (dokumentInnsendingBaseURL, config) => {
const root = createRoot(document.getElementById('root')!);
root.render(
<StrictMode>
<BrowserRouter basename="/fyllut">
<AppConfigProvider
dokumentinnsendingBaseURL={dokumentInnsendingBaseURL}
Expand All @@ -44,5 +45,6 @@ const renderReact = (dokumentInnsendingBaseURL, config) => {
<App />
</AppConfigProvider>
</BrowserRouter>
</StrictMode>,
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ describe('NavDatePicker', () => {
expect(datepickerInput.value).toBe('01.01.2020');

await userEvent.clear(datepickerInput);
datepickerInput.blur();
expect(datepickerInput.value).toBe('');

const nextButton = screen.getByRole('button', { name: 'Neste steg' });
expect(nextButton).toBeInTheDocument();
nextButton.click();
await act(async () => nextButton.click());

const errorMessage = await screen.findByText('Du må fylle ut: Dato (dd.mm.åååå)');
expect(errorMessage).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export default class DatePicker extends BaseComponent {
this.t.bind(this),
);

return this.setComponentValidity(errorMessage ? [this.createError(errorMessage, undefined)] : [], dirty, undefined);
return this.setComponentValidity(
errorMessage ? [this.createError(errorMessage, undefined)] : [],
dirty,
undefined,
);
}

return true;
Expand Down Expand Up @@ -99,10 +103,7 @@ export default class DatePicker extends BaseComponent {
this.updateValue(value, { modified: true });

if (this.component?.beforeDateInputKey) {
const referenceComponent = navFormUtils.findByKey(
this.component?.beforeDateInputKey,
this.root.getComponents(),
);
const referenceComponent = navFormUtils.findByKey(this.component?.beforeDateInputKey, this.root.getComponents());
referenceComponent?.rerender?.();
} else {
this.getComponentsWithDateInputKey().map((component) => component.rerender?.());
Expand Down

0 comments on commit 0714f27

Please sign in to comment.