Skip to content

Commit

Permalink
wip: testit kuntoon
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkkahanninen committed Jan 8, 2025
1 parent 23762b3 commit 7dadab2
Show file tree
Hide file tree
Showing 22 changed files with 1,818 additions and 267 deletions.
2 changes: 1 addition & 1 deletion web/app/components-v2/controls/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Checkbox: React.FC<CheckboxProps> = (props) => {
onChange={(event) => props.onChange(event.target.checked)}
data-testid={testId}
/>
<label htmlFor={id}>
<label htmlFor={id} onClick={() => props.onChange(!props.checked)}>
<span className="Checkbox__label">{t(props.label)}</span>
</label>
</div>
Expand Down
15 changes: 9 additions & 6 deletions web/app/components-v2/opiskeluoikeus/KoodistoField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { t } from '../../i18n/i18n'
import { Koodistokoodiviite } from '../../types/fi/oph/koski/schema/Koodistokoodiviite'
import { CommonProps, common } from '../CommonProps'
import { FieldEditorProps, FieldViewerProps } from '../forms/FormField'
import { TestIdLayer } from '../../appstate/useTestId'
import { TestIdLayer, useTestId } from '../../appstate/useTestId'
import {
Select,
SelectOption,
Expand All @@ -24,11 +24,14 @@ export type KoodistoViewProps<T extends string> = CommonProps<
>
>

export const KoodistoView = <T extends string>(props: KoodistoViewProps<T>) => (
<div {...common(props)} data-testid={props.testId}>
{t(props.value?.nimi) || '–'}
</div>
)
export const KoodistoView = <T extends string>(props: KoodistoViewProps<T>) => {
const testId = useTestId(props.testId)
return (
<div {...common(props)} data-testid={testId}>
{t(props.value?.nimi) || '–'}
</div>
)
}

export type KoodistoEditProps<T extends string> = CommonProps<
FieldEditorProps<
Expand Down
17 changes: 10 additions & 7 deletions web/app/components-v2/opiskeluoikeus/OpiskeluoikeudenTila.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,16 @@ export const OpiskeluoikeudenTilaView = <T extends OpiskeluoikeudenTila>(
</TestIdText>
</time>,
<React.Fragment key={`jakso_tila_lisatiedot_${index}`}>
<TestIdText id="tila">
<span>{t(jakso.tila.nimi)}</span>
<span>
{isRahoituksellinenOpiskeluoikeusjakso(jakso) &&
` (${t(jakso.opintojenRahoitus?.nimi)})`}
</span>
</TestIdText>
<TestIdText id="tila">{t(jakso.tila.nimi)}</TestIdText>
{isRahoituksellinenOpiskeluoikeusjakso(jakso) && (
<>
{' ('}
<TestIdText id="rahoitus">
{t(jakso.opintojenRahoitus?.nimi)}
</TestIdText>
{')'}
</>
)}
</React.Fragment>
]}
</KeyColumnedValuesRow>
Expand Down
Loading

0 comments on commit 7dadab2

Please sign in to comment.