Skip to content

Commit

Permalink
Merge pull request #62 from Opetushallitus/OK-674_suorittamattomat-ha…
Browse files Browse the repository at this point in the history
…kukohteet-fix

OK-674: Ei näytetä tyhjää "suorittamattomat hakukohteet"-haitaria
  • Loading branch information
pretseli authored Jan 7, 2025
2 parents d5e254e + 4a5653a commit c2e8d3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ErrorWithIcon } from '@/app/components/error-with-icon';
import { SimpleAccordion } from '@/app/components/simple-accordion';
import { useTranslations } from '@/app/hooks/useTranslations';
import { isEmpty } from '@/app/lib/common';
import { NDASH } from '@/app/lib/constants';
import { LaskentaActorRef } from '@/app/lib/state/laskenta-state';
import { Hakukohde } from '@/app/lib/types/kouta-types';
Expand All @@ -25,7 +26,7 @@ export const SuorittamattomatHakukohteet = ({
s.context.summary?.hakukohteet.filter((hk) => hk?.tila !== 'VALMIS'),
);

return summaryErrors ? (
return isEmpty(summaryErrors) ? null : (
<SimpleAccordion
titleOpen={t('henkilo.piilota-suorittamattomat-hakukohteet')}
titleClosed={t('henkilo.nayta-suorittamattomat-hakukohteet')}
Expand Down Expand Up @@ -72,5 +73,5 @@ export const SuorittamattomatHakukohteet = ({
})}
</Stack>
</SimpleAccordion>
) : null;
);
};
7 changes: 6 additions & 1 deletion tests/e2e/henkilo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,11 @@ test.describe('Valintalaskenta', () => {
page.getByText('Laskenta suoritettu onnistuneesti'),
).toBeVisible();

const suljeTiedotButton = page.getByRole('button', {
name: 'Sulje laskennan tiedot',
});
await expect(suljeTiedotButton).toBeVisible();

await expect(
page.getByRole('button', { name: 'Näytä suorittamattomat hakukohteet' }),
).toBeHidden();
Expand All @@ -970,7 +975,7 @@ test.describe('Valintalaskenta', () => {
page.getByRole('button', { name: 'Suorita valintalaskenta' }),
).toBeHidden();

await page.getByRole('button', { name: 'Sulje laskennan tiedot' }).click();
await suljeTiedotButton.click();

await expect(
page.getByRole('button', { name: 'Suorita valintalaskenta' }),
Expand Down

0 comments on commit c2e8d3e

Please sign in to comment.