Skip to content

Commit

Permalink
Fiks accordion items defaulty open
Browse files Browse the repository at this point in the history
  • Loading branch information
poroshinaleksei committed Jan 15, 2025
1 parent 62f79a9 commit a58d9e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ const ArbeidsforholdPanel = ({
return (
<Accordion.Item
open={isOpen}
defaultOpen={isOpen}
defaultOpen={
!!soknad.arbeidstid?.arbeidstakerList?.length ||
!!soknad.opptjeningAktivitet.frilanser ||
!!soknad.opptjeningAktivitet.selvstendigNaeringsdrivende
}
onOpenChange={() => onPanelClick()}
data-testid="accordionItem-arbeidsforholdPanel"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ const EndringAvSøknadsperioder = (props: Props) => {

return (
<Accordion.Item
defaultOpen={isOpen}
open={isOpen}
defaultOpen={!!soknad.trekkKravPerioder && soknad.trekkKravPerioder.length > 0}
className="endringAvSøknadsperioder"
onOpenChange={onClick}
data-testid="accordionItem-endringAvSøknadsperioderpanel"
Expand Down
18 changes: 12 additions & 6 deletions src/app/søknader/pleiepenger/containers/PSBPunchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,9 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF
<VerticalSpacer sixteenPx />

<Accordion.Item
open={this.utenlandsOppholdCheckedValue() === JaNeiIkkeOpplyst.JA}
// defaultOpen={this.checkOpenState(PunchFormPaneler.UTENLANDSOPPHOLD)}
defaultOpen={this.checkOpenState(PunchFormPaneler.UTENLANDSOPPHOLD)}
open={this.checkOpenState(PunchFormPaneler.UTENLANDSOPPHOLD)}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.UTENLANDSOPPHOLD)}
data-testid="accordionItem-utenlandsoppholdpanel"
>
Expand Down Expand Up @@ -942,7 +943,8 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF

<Accordion.Item
open={this.checkOpenState(PunchFormPaneler.FERIE)}
defaultOpen={this.checkOpenState(PunchFormPaneler.FERIE)}
// defaultOpen={this.checkOpenState(PunchFormPaneler.FERIE)}
defaultOpen={!!soknad.lovbestemtFerie.length}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.FERIE)}
data-testid="accordionItem-feriepanel"
>
Expand Down Expand Up @@ -1030,7 +1032,8 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF

<Accordion.Item
open={this.checkOpenState(PunchFormPaneler.OPPLYSINGER_OM_SOKER)}
defaultOpen={this.checkOpenState(PunchFormPaneler.OPPLYSINGER_OM_SOKER)}
defaultOpen={!!soknad.omsorg.relasjonTilBarnet}
// defaultOpen={this.checkOpenState(PunchFormPaneler.OPPLYSINGER_OM_SOKER)}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.OPPLYSINGER_OM_SOKER)}
data-testid="accordionItem-opplysningeromsokerpanel"
>
Expand Down Expand Up @@ -1067,7 +1070,8 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF

<Accordion.Item
open={this.checkOpenState(PunchFormPaneler.OMSORGSTILBUD)}
defaultOpen={this.checkOpenState(PunchFormPaneler.OMSORGSTILBUD)}
// defaultOpen={this.checkOpenState(PunchFormPaneler.OMSORGSTILBUD)}
defaultOpen={!!this.state.iTilsynsordning}
className={classNames('tilsynsordning')}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.OMSORGSTILBUD)}
data-testid="accordionItem-omsorgstilbudpanel"
Expand Down Expand Up @@ -1117,7 +1121,8 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF

<Accordion.Item
open={this.checkOpenState(PunchFormPaneler.BEREDSKAPNATTEVAAK)}
defaultOpen={this.checkOpenState(PunchFormPaneler.BEREDSKAPNATTEVAAK)}
// defaultOpen={this.checkOpenState(PunchFormPaneler.BEREDSKAPNATTEVAAK)}
defaultOpen={!!soknad.beredskap.length || !!soknad.nattevaak.length}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.BEREDSKAPNATTEVAAK)}
data-testid="accordionItem-beredskapnattevaakpanel"
>
Expand Down Expand Up @@ -1152,7 +1157,8 @@ export class PunchFormComponent extends React.Component<IPunchFormProps, IPunchF

<Accordion.Item
open={this.checkOpenState(PunchFormPaneler.MEDLEMSKAP)}
defaultOpen={this.checkOpenState(PunchFormPaneler.MEDLEMSKAP)}
// defaultOpen={this.checkOpenState(PunchFormPaneler.MEDLEMSKAP)}
defaultOpen={this.medlemskapCheckedValue() === JaNeiIkkeOpplyst.JA}
onOpenChange={() => this.handlePanelClick(PunchFormPaneler.MEDLEMSKAP)}
data-testid="accordionItem-medlemskappanel"
>
Expand Down

0 comments on commit a58d9e3

Please sign in to comment.