Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ describe('Save and Exit functionality', () => {
jest
.spyOn(controller1, 'handleSaveAndExit')
.mockReturnValue(h.redirect('/custom-save-and-exit'))
jest.spyOn(controller1, 'setState').mockResolvedValue(state)

const postHandler = controller1.makePostRouteHandler()
await postHandler(request, context, h)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,16 @@ export class QuestionPageController extends PageController {
return h.view(viewName, viewModel)
}

// Save state
await this.setState(request, state)

// Check if this is a save-and-exit action
const { action } = request.payload
if (action === FormAction.SaveAndExit) {
return this.handleSaveAndExit(request, context, h)
}

// Save and proceed
await this.setState(request, state)
// Proceed to the next page
return this.proceed(request, h, this.getNextPath(context))
}
}
Expand Down
Loading