-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from ONSdigital/ear-1673-add-submission-config…
…-in-publisher EAR-1673 Add submission configuration in publisher
- Loading branch information
Showing
3 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Submission { | ||
constructor(postSubmission) { | ||
this.button = "Submit"; | ||
if (postSubmission.viewPrintAnswers) { | ||
this.guidance = | ||
"You will have the opportunity to view, save or print a copy of your answers after submitting this survey."; | ||
} | ||
this.title = "Submit your questionnaire"; | ||
this.warning = "You cannot view your answers after submission"; | ||
} | ||
} | ||
|
||
module.exports = Submission; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const Submission = require("."); | ||
|
||
describe("Submission with guidance", () => { | ||
let submission; | ||
beforeEach(() => { | ||
submission = { | ||
id: "07b92a18-180c-4c35-9e94-aa6df9cdee6b", | ||
furtherContent: | ||
'<p>Your response will help inform decision-makers how best to support the UK population and economy at this challenging time.</p><p><a href="https://www.ons.gov.uk/surveys" target="_blank" rel="noopener noreferrer">Learn more about how we use this data</a></p>', | ||
viewPrintAnswers: true, | ||
emailConfirmation: true, | ||
feedback: true | ||
}; | ||
}); | ||
|
||
it("should set the correct data", () => { | ||
const renderSubmission = new Submission(submission); | ||
|
||
expect(renderSubmission.button).toBeTruthy(); | ||
expect(renderSubmission.guidance).toBeTruthy(); | ||
expect(renderSubmission.title).toBeTruthy(); | ||
expect(renderSubmission.warning).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe("Submission without guidance", () => { | ||
let submissionWithout; | ||
beforeEach(() => { | ||
submissionWithout = { | ||
id: "07b92a18-180c-4c35-9e94-aa6df9cdee6b", | ||
furtherContent: | ||
'<p>Your response will help inform decision-makers how best to support the UK population and economy at this challenging time.</p><p><a href="https://www.ons.gov.uk/surveys" target="_blank" rel="noopener noreferrer">Learn more about how we use this data</a></p>', | ||
viewPrintAnswers: false, | ||
emailConfirmation: true, | ||
feedback: true | ||
}; | ||
}); | ||
|
||
it("should set the correct data", () => { | ||
const renderSubmission = new Submission(submissionWithout); | ||
|
||
expect(renderSubmission.button).toBeTruthy(); | ||
expect(renderSubmission.guidance).toBeFalsy(); | ||
expect(renderSubmission.title).toBeTruthy(); | ||
expect(renderSubmission.warning).toBeTruthy(); | ||
}); | ||
}); |