Skip to content

Commit

Permalink
Endring for å hindre sletting av vedlegg når filer lastes opp. Endrin…
Browse files Browse the repository at this point in the history
…ger etter PR
  • Loading branch information
nils-arne committed Sep 23, 2024
1 parent 648a4b4 commit 8c91f3f
Show file tree
Hide file tree
Showing 5 changed files with 310 additions and 331 deletions.
8 changes: 4 additions & 4 deletions components/Fil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export interface FilProps {
lokalFil?: File;
opplastetFil?: OpplastetFil;
filListeDispatch: React.Dispatch<ActionType>;
lasterOppStateDispoatch: React.Dispatch<number>;
lasterOppStateDispatch: React.Dispatch<number>;
}

export interface FilData {
Expand Down Expand Up @@ -252,7 +252,7 @@ export function Fil({
innsendingsId,
vedlegg,
filListeDispatch,
lasterOppStateDispoatch,
lasterOppStateDispatch,
}: FilProps) {
const [filState, dispatch] = useReducer(filReducer, initialState);
const { status } = filState;
Expand Down Expand Up @@ -356,7 +356,7 @@ export function Fil({
type: FIL_ACTIONS.SETT_STATUS,
filState: { status: FIL_STATUS.LASTER_OPP },
});
lasterOppStateDispoatch(1);
lasterOppStateDispatch(1);

axios
.post(`${API_URL}/frontend/v1/soknad/${innsendingsId}/vedlegg/${vedlegg.id}/fil`, formData, config)
Expand Down Expand Up @@ -415,7 +415,7 @@ export function Fil({
progress: 0,
},
});
lasterOppStateDispoatch(-1);
lasterOppStateDispatch(-1);
});
}, [
filState,
Expand Down
2 changes: 1 addition & 1 deletion components/Vedlegg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ function Vedlegg(props: VedleggProps) {
lokalFil={fil.lokalFil}
opplastetFil={fil.opplastetFil}
filListeDispatch={dispatch}
lasterOppStateDispoatch={dispatchLasterOppState}
lasterOppStateDispatch={dispatchLasterOppState}
/>
);
})}
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/validering.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ describe('Tester validering', () => {
cy.get('li').should('have.length', 1);
});

// Laster opp fil og forsøker å slette mens
cy.get('[data-cy="VedleggContainer"]')
.eq(3)
.within(() => {
cy.get('[data-cy="filvelgerKnapp"]').click();
cy.get('[data-cy="filvelgerKnapp"]').selectFile('cypress/fixtures/MarcusAurelius.jpeg');
cy.contains(translations.soknad.vedlegg.annet.slett).click();
cy.get('[data-cy="fileUploadSuccessIkon"]').should('be.visible');
});

cy.get('[data-cy="VedleggContainer"]')
.eq(3)
.within(() => {
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
Loading

0 comments on commit 8c91f3f

Please sign in to comment.