@planning-inspectorate/dynamic-forms 3.9.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/address/index.njk +1 -6
- package/src/components/boolean/index.njk +1 -6
- package/src/components/boolean/question.js +5 -2
- package/src/components/checkbox/index.njk +1 -6
- package/src/components/checkbox/question.js +4 -2
- package/src/components/date/index.njk +1 -21
- package/src/components/date-period/index.njk +1 -6
- package/src/components/date-time/index.njk +1 -6
- package/src/components/identifier/index.njk +1 -6
- package/src/components/manage-list/index.njk +1 -6
- package/src/components/multi-field-input/index.njk +1 -7
- package/src/components/number-entry/index.njk +1 -6
- package/src/components/radio/index.njk +1 -21
- package/src/components/select/index.njk +1 -22
- package/src/components/single-line-input/index.njk +1 -6
- package/src/components/task-list/index.njk +0 -1
- package/src/components/text-entry/index.njk +1 -6
- package/src/components/text-entry-redact/index.njk +1 -5
- package/src/components/unit-option-entry/index.njk +1 -6
- package/src/components/utils/actions.njk +35 -0
- package/src/questions/question-types.d.ts +26 -1
- package/src/questions/question.js +10 -3
- package/test/secondary-actions.test.js +253 -0
- package/test/snapshots/add-insurance.html +2 -1
- package/test/snapshots/companions.html +1 -1
- package/test/snapshots/contact-email.html +2 -1
- package/test/snapshots/departure-date.html +2 -2
- package/test/snapshots/holiday-activities.html +2 -1
- package/test/snapshots/holiday-arrival.html +2 -1
- package/test/snapshots/holiday-description.html +2 -1
- package/test/snapshots/holiday-destination.html +2 -2
- package/test/snapshots/holiday-period.html +2 -1
- package/test/snapshots/holiday-snack.html +2 -1
- package/test/snapshots/hotel-address.html +2 -1
- package/test/snapshots/luggage-weight-units.html +2 -1
- package/test/snapshots/manage-list-render-questions.html +2 -1
- package/test/snapshots/manage-list-render.html +2 -1
- package/test/snapshots/nights.html +3 -2
- package/test/snapshots/secondary-actions-radio-plain.html +46 -0
- package/test/snapshots/secondary-actions-radio.html +53 -0
- package/test/snapshots/secret-wish.html +2 -1
- package/test/snapshots/travel-class.html +2 -2
- package/test/snapshots/travel-companions.html +2 -1
- package/test/snapshots/travel-companions_travel-companion-email.html +2 -1
- package/test/snapshots/travel-companions_travel-companion-name.html +2 -1
- package/test/snapshots/travel-insurance-type.html +2 -2
- package/types/src/components/boolean/question.d.ts +3 -1
- package/types/src/components/boolean/question.d.ts.map +1 -1
- package/types/src/components/checkbox/question.d.ts +3 -1
- package/types/src/components/checkbox/question.d.ts.map +1 -1
- package/types/src/questions/question-types.d.ts +26 -1
- package/types/src/questions/question.d.ts +13 -2
- package/types/src/questions/question.d.ts.map +1 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
import { COMPONENT_TYPES, Journey, Section } from '../src/index.js';
|
|
4
|
+
import { createAppWithQuestions } from '#test/utils/question-test-utils.js';
|
|
5
|
+
import { createQuestions } from '../src/questions/create-questions.js';
|
|
6
|
+
import { questionClasses } from '../src/questions/questions.js';
|
|
7
|
+
import { questionProps, questionsInOrder } from '#test/questions.js';
|
|
8
|
+
import { assertSnapshot } from '#test/utils/utils.js';
|
|
9
|
+
import { mockRandomUUID } from '#test/mock/uuid.js';
|
|
10
|
+
import { createJourney as createTestJourney, JOURNEY_ID } from '#test/journey.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('../src/questions/question-types.d.ts').SecondaryAction[]}
|
|
14
|
+
*/
|
|
15
|
+
const testSecondaryActions = [
|
|
16
|
+
{
|
|
17
|
+
text: 'Save and return',
|
|
18
|
+
href: '/return',
|
|
19
|
+
classes: 'govuk-button--secondary'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
text: 'Cancel',
|
|
23
|
+
type: 'submit',
|
|
24
|
+
formaction: '/cancel',
|
|
25
|
+
classes: 'govuk-button--secondary'
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Build question props with secondaryActions appended, from questionsInOrder.
|
|
31
|
+
*/
|
|
32
|
+
const questionPropsWithSecondaryActions = Object.fromEntries(
|
|
33
|
+
Object.entries(questionProps).map(([k, v]) => [
|
|
34
|
+
k,
|
|
35
|
+
{
|
|
36
|
+
...v,
|
|
37
|
+
viewData: {
|
|
38
|
+
...v.viewData,
|
|
39
|
+
secondaryActions: testSecondaryActions
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
])
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Question definitions that use the deprecated extraActionButtons
|
|
47
|
+
*/
|
|
48
|
+
const questionPropsWithExtraActionButtons = {
|
|
49
|
+
testRadioLegacy: {
|
|
50
|
+
type: COMPONENT_TYPES.RADIO,
|
|
51
|
+
title: 'Test Radio Legacy',
|
|
52
|
+
question: 'Pick an option (legacy)',
|
|
53
|
+
fieldName: 'testRadioLegacy',
|
|
54
|
+
url: 'test-radio-legacy',
|
|
55
|
+
options: [
|
|
56
|
+
{ value: 'a', text: 'Option A' },
|
|
57
|
+
{ value: 'b', text: 'Option B' }
|
|
58
|
+
],
|
|
59
|
+
viewData: {
|
|
60
|
+
extraActionButtons: testSecondaryActions
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function createBasicJourney(questions, response) {
|
|
66
|
+
const section = new Section('Test', 'questions');
|
|
67
|
+
for (const q of Object.values(questions)) {
|
|
68
|
+
section.addQuestion(q);
|
|
69
|
+
}
|
|
70
|
+
return new Journey({
|
|
71
|
+
journeyId: JOURNEY_ID,
|
|
72
|
+
sections: [section],
|
|
73
|
+
taskListUrl: 'check-your-answers',
|
|
74
|
+
journeyTemplate: 'views/layout-journey.njk',
|
|
75
|
+
taskListTemplate: 'views/layout-check-your-answers.njk',
|
|
76
|
+
journeyTitle: 'Secondary Actions Test',
|
|
77
|
+
returnToListing: false,
|
|
78
|
+
makeBaseUrl: () => '/',
|
|
79
|
+
initialBackLink: '/',
|
|
80
|
+
response
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getQuestions(props) {
|
|
85
|
+
return createQuestions(props, questionClasses, {});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
describe('secondary actions', () => {
|
|
89
|
+
describe('renders secondaryActions buttons', () => {
|
|
90
|
+
const questionTypes = Object.entries(questionPropsWithSecondaryActions)
|
|
91
|
+
// filter out manage list sub-questions
|
|
92
|
+
.filter(([, v]) => questionsInOrder.some((q) => q.fieldName === v.fieldName));
|
|
93
|
+
|
|
94
|
+
for (const [, props] of questionTypes) {
|
|
95
|
+
it(`should render secondary action buttons for ${props.type} component`, async (ctx) => {
|
|
96
|
+
const questions = getQuestions(questionPropsWithSecondaryActions);
|
|
97
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
98
|
+
journeyId: JOURNEY_ID,
|
|
99
|
+
questions,
|
|
100
|
+
createJourneyFn: (q, response) => createTestJourney(q, response)
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const response = await testServer.get(`/questions/${props.url}`, { redirect: 'manual' });
|
|
104
|
+
assert.strictEqual(response.status, 200);
|
|
105
|
+
const text = await response.text();
|
|
106
|
+
|
|
107
|
+
// should render the primary submit button
|
|
108
|
+
assert.match(text, /button-save-and-continue/);
|
|
109
|
+
|
|
110
|
+
// should wrap buttons in a button group
|
|
111
|
+
assert.match(text, /govuk-button-group/);
|
|
112
|
+
|
|
113
|
+
// should render the secondary action buttons
|
|
114
|
+
assert.match(text, /Save and return/);
|
|
115
|
+
assert.match(text, /button-save-and-return/);
|
|
116
|
+
assert.match(text, /Cancel/);
|
|
117
|
+
assert.match(text, /button-cancel/);
|
|
118
|
+
|
|
119
|
+
// should have secondary button classes
|
|
120
|
+
assert.match(text, /govuk-button--secondary/);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('backwards compatibility with extraActionButtons', () => {
|
|
126
|
+
it('should render buttons when extraActionButtons is used', async (ctx) => {
|
|
127
|
+
const questions = getQuestions(questionPropsWithExtraActionButtons);
|
|
128
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
129
|
+
journeyId: JOURNEY_ID,
|
|
130
|
+
questions,
|
|
131
|
+
createJourneyFn: (q, response) => createBasicJourney(q, response)
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const response = await testServer.get('/questions/test-radio-legacy', { redirect: 'manual' });
|
|
135
|
+
assert.strictEqual(response.status, 200);
|
|
136
|
+
const text = await response.text();
|
|
137
|
+
|
|
138
|
+
// should still render the secondary action buttons via backwards compat
|
|
139
|
+
assert.match(text, /Save and return/);
|
|
140
|
+
assert.match(text, /button-save-and-return/);
|
|
141
|
+
assert.match(text, /Cancel/);
|
|
142
|
+
assert.match(text, /button-cancel/);
|
|
143
|
+
assert.match(text, /govuk-button--secondary/);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('renders without secondaryActions', () => {
|
|
148
|
+
it('should render only the submit button when no secondaryActions', async (ctx) => {
|
|
149
|
+
// Use the first radio question without secondary actions
|
|
150
|
+
const radioQuestion = questionsInOrder.find((q) => q.type === COMPONENT_TYPES.RADIO);
|
|
151
|
+
const questionPropsNoActions = {
|
|
152
|
+
[radioQuestion.fieldName]: { ...radioQuestion }
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const questions = getQuestions(questionPropsNoActions);
|
|
156
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
157
|
+
journeyId: JOURNEY_ID,
|
|
158
|
+
questions,
|
|
159
|
+
createJourneyFn: (q, response) => createBasicJourney(q, response)
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const response = await testServer.get(`/questions/${radioQuestion.url}`, { redirect: 'manual' });
|
|
163
|
+
assert.strictEqual(response.status, 200);
|
|
164
|
+
const text = await response.text();
|
|
165
|
+
|
|
166
|
+
// should render the primary submit button
|
|
167
|
+
assert.match(text, /button-save-and-continue/);
|
|
168
|
+
|
|
169
|
+
// should NOT wrap in a button group
|
|
170
|
+
assert.doesNotMatch(text, /govuk-button-group/);
|
|
171
|
+
|
|
172
|
+
// should NOT render secondary action buttons
|
|
173
|
+
assert.doesNotMatch(text, /button-save-and-return/);
|
|
174
|
+
assert.doesNotMatch(text, /button-cancel/);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('secondary action button attributes', () => {
|
|
179
|
+
const firstQuestionProps = Object.values(questionPropsWithSecondaryActions)[0];
|
|
180
|
+
|
|
181
|
+
it('should render formaction attribute', async (ctx) => {
|
|
182
|
+
const questions = getQuestions(questionPropsWithSecondaryActions);
|
|
183
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
184
|
+
journeyId: JOURNEY_ID,
|
|
185
|
+
questions,
|
|
186
|
+
createJourneyFn: (q, response) => createTestJourney(q, response)
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const response = await testServer.get(`/questions/${firstQuestionProps.url}`, { redirect: 'manual' });
|
|
190
|
+
assert.strictEqual(response.status, 200);
|
|
191
|
+
const text = await response.text();
|
|
192
|
+
|
|
193
|
+
// Cancel button should have formaction="/cancel"
|
|
194
|
+
assert.match(text, /formaction="\/cancel"/);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('should render href attribute for link actions', async (ctx) => {
|
|
198
|
+
const questions = getQuestions(questionPropsWithSecondaryActions);
|
|
199
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
200
|
+
journeyId: JOURNEY_ID,
|
|
201
|
+
questions,
|
|
202
|
+
createJourneyFn: (q, response) => createTestJourney(q, response)
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const response = await testServer.get(`/questions/${firstQuestionProps.url}`, { redirect: 'manual' });
|
|
206
|
+
assert.strictEqual(response.status, 200);
|
|
207
|
+
const text = await response.text();
|
|
208
|
+
|
|
209
|
+
// "Save and return" link action should have href="/return"
|
|
210
|
+
assert.match(text, /href="\/return"/);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe('snapshots', () => {
|
|
215
|
+
const radioQuestion = questionsInOrder.find((q) => q.type === COMPONENT_TYPES.RADIO);
|
|
216
|
+
|
|
217
|
+
it('should match snapshot with secondary actions', async (ctx) => {
|
|
218
|
+
const questions = getQuestions(questionPropsWithSecondaryActions);
|
|
219
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
220
|
+
journeyId: JOURNEY_ID,
|
|
221
|
+
questions,
|
|
222
|
+
createJourneyFn: (q, response) => createTestJourney(q, response)
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
mockRandomUUID(ctx);
|
|
226
|
+
const response = await testServer.get(`/questions/${radioQuestion.url}`, { redirect: 'manual' });
|
|
227
|
+
assert.strictEqual(response.status, 200);
|
|
228
|
+
const text = await response.text();
|
|
229
|
+
|
|
230
|
+
assertSnapshot(ctx, text, 'secondary-actions-radio.html');
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should match snapshot without secondary actions', async (ctx) => {
|
|
234
|
+
const questionPropsNoActions = {
|
|
235
|
+
[radioQuestion.fieldName]: { ...radioQuestion }
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const questions = getQuestions(questionPropsNoActions);
|
|
239
|
+
const testServer = await createAppWithQuestions(ctx, {
|
|
240
|
+
journeyId: JOURNEY_ID,
|
|
241
|
+
questions,
|
|
242
|
+
createJourneyFn: (q, response) => createBasicJourney(q, response)
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
mockRandomUUID(ctx);
|
|
246
|
+
const response = await testServer.get(`/questions/${radioQuestion.url}`, { redirect: 'manual' });
|
|
247
|
+
assert.strictEqual(response.status, 200);
|
|
248
|
+
const text = await response.text();
|
|
249
|
+
|
|
250
|
+
assertSnapshot(ctx, text, 'secondary-actions-radio-plain.html');
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
30
30
|
Continue
|
|
31
31
|
</button>
|
|
32
|
+
|
|
32
33
|
</form>
|
|
33
34
|
</div>
|
|
34
35
|
</div>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
</fieldset>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
33
33
|
Continue
|
|
34
34
|
</button>
|
|
35
35
|
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
19
19
|
Continue
|
|
20
20
|
</button>
|
|
21
|
+
|
|
21
22
|
</form>
|
|
22
23
|
</div>
|
|
23
24
|
</div>
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
41
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
43
42
|
Continue
|
|
44
43
|
</button>
|
|
44
|
+
|
|
45
45
|
</form>
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
</fieldset>
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
35
35
|
Continue
|
|
36
36
|
</button>
|
|
37
|
+
|
|
37
38
|
</form>
|
|
38
39
|
</div>
|
|
39
40
|
</div>
|
|
@@ -84,9 +84,10 @@
|
|
|
84
84
|
</fieldset>
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
88
88
|
Continue
|
|
89
89
|
</button>
|
|
90
|
+
|
|
90
91
|
</form>
|
|
91
92
|
</div>
|
|
92
93
|
</div>
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
19
19
|
Continue
|
|
20
20
|
</button>
|
|
21
|
+
|
|
21
22
|
</form>
|
|
22
23
|
</div>
|
|
23
24
|
</div>
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
|
|
38
38
|
</fieldset>
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
40
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
42
41
|
Continue
|
|
43
42
|
</button>
|
|
43
|
+
|
|
44
44
|
</form>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
@@ -83,9 +83,10 @@
|
|
|
83
83
|
</div>
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
87
87
|
Continue
|
|
88
88
|
</button>
|
|
89
|
+
|
|
89
90
|
</form>
|
|
90
91
|
</div>
|
|
91
92
|
</div>
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
19
19
|
Continue
|
|
20
20
|
</button>
|
|
21
|
+
|
|
21
22
|
</form>
|
|
22
23
|
</div>
|
|
23
24
|
</div>
|
|
@@ -48,10 +48,11 @@
|
|
|
48
48
|
<input class="govuk-input govuk-input--width-10" id="address-postcode" name="hotelAddress_postcode" type="text" value="" autocomplete="postal-code">
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
52
52
|
Continue
|
|
53
53
|
</button>
|
|
54
54
|
|
|
55
|
+
|
|
55
56
|
</fieldset>
|
|
56
57
|
</form>
|
|
57
58
|
</div>
|
|
@@ -52,9 +52,10 @@
|
|
|
52
52
|
|
|
53
53
|
</fieldset>
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
56
56
|
Continue
|
|
57
57
|
</button>
|
|
58
|
+
|
|
58
59
|
</form>
|
|
59
60
|
</div>
|
|
60
61
|
</div>
|
|
@@ -89,9 +89,10 @@
|
|
|
89
89
|
<a href="/add/00000000-0000-0000-0000-000000000000/first-question" class="govuk-link">Add another</a>
|
|
90
90
|
</p>
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
93
93
|
Continue
|
|
94
94
|
</button>
|
|
95
|
+
|
|
95
96
|
</form>
|
|
96
97
|
</div>
|
|
97
98
|
</div>
|
|
@@ -83,9 +83,10 @@
|
|
|
83
83
|
<a href="/add/00000000-0000-0000-0000-000000000000/first-question" class="govuk-link">Add another</a>
|
|
84
84
|
</p>
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
87
87
|
Continue
|
|
88
88
|
</button>
|
|
89
|
+
|
|
89
90
|
</form>
|
|
90
91
|
</div>
|
|
91
92
|
</div>
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
<input class="govuk-input govuk-input--width-5" id="nights" name="nights" type="text" spellcheck="false" value="" inputmode="numeric">
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
13
13
|
Continue
|
|
14
14
|
</button>
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
</form>
|
|
16
17
|
</div>
|
|
17
18
|
</div>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<div class="govuk-grid-row">
|
|
2
|
+
<div class="govuk-grid-column-two-thirds">
|
|
3
|
+
<form action="" method="post" novalidate>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<fieldset class="govuk-fieldset">
|
|
7
|
+
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
|
|
8
|
+
<h1 class="govuk-fieldset__heading">
|
|
9
|
+
Which type of travel insurance would you like?
|
|
10
|
+
</h1>
|
|
11
|
+
</legend>
|
|
12
|
+
|
|
13
|
+
<div class="govuk-form-group">
|
|
14
|
+
<div class="govuk-radios govuk-radios" data-module="govuk-radios">
|
|
15
|
+
<div class="govuk-radios__item">
|
|
16
|
+
<input class="govuk-radios__input" id="travelInsuranceType" name="travelInsuranceType" type="radio" value="basic" data-cy="answer-basic">
|
|
17
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType">
|
|
18
|
+
Basic
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="govuk-radios__item">
|
|
22
|
+
<input class="govuk-radios__input" id="travelInsuranceType-2" name="travelInsuranceType" type="radio" value="comprehensive" data-cy="answer-comprehensive">
|
|
23
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType-2">
|
|
24
|
+
Comprehensive
|
|
25
|
+
</label>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="govuk-radios__item">
|
|
28
|
+
<input class="govuk-radios__input" id="travelInsuranceType-3" name="travelInsuranceType" type="radio" value="premium" data-cy="answer-premium">
|
|
29
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType-3">
|
|
30
|
+
Premium
|
|
31
|
+
</label>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</fieldset>
|
|
39
|
+
|
|
40
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
41
|
+
Continue
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
|
+
</form>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<div class="govuk-grid-row">
|
|
2
|
+
<div class="govuk-grid-column-two-thirds">
|
|
3
|
+
<form action="" method="post" novalidate>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<fieldset class="govuk-fieldset">
|
|
7
|
+
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
|
|
8
|
+
<h1 class="govuk-fieldset__heading">
|
|
9
|
+
Which type of travel insurance would you like?
|
|
10
|
+
</h1>
|
|
11
|
+
</legend>
|
|
12
|
+
|
|
13
|
+
<div class="govuk-form-group">
|
|
14
|
+
<div class="govuk-radios govuk-radios" data-module="govuk-radios">
|
|
15
|
+
<div class="govuk-radios__item">
|
|
16
|
+
<input class="govuk-radios__input" id="travelInsuranceType" name="travelInsuranceType" type="radio" value="basic" data-cy="answer-basic">
|
|
17
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType">
|
|
18
|
+
Basic
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="govuk-radios__item">
|
|
22
|
+
<input class="govuk-radios__input" id="travelInsuranceType-2" name="travelInsuranceType" type="radio" value="comprehensive" data-cy="answer-comprehensive">
|
|
23
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType-2">
|
|
24
|
+
Comprehensive
|
|
25
|
+
</label>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="govuk-radios__item">
|
|
28
|
+
<input class="govuk-radios__input" id="travelInsuranceType-3" name="travelInsuranceType" type="radio" value="premium" data-cy="answer-premium">
|
|
29
|
+
<label class="govuk-label govuk-radios__label" for="travelInsuranceType-3">
|
|
30
|
+
Premium
|
|
31
|
+
</label>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</fieldset>
|
|
39
|
+
|
|
40
|
+
<div class="govuk-button-group">
|
|
41
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
42
|
+
Continue
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
<a href="/return" role="button" draggable="false" class="govuk-button govuk-button--secondary" data-module="govuk-button" data-cy="button-save-and-return">
|
|
46
|
+
Save and return
|
|
47
|
+
</a>
|
|
48
|
+
<button type="submit" class="govuk-button govuk-button--secondary" data-module="govuk-button" data-cy="button-cancel" name="cancel" formaction="/cancel">
|
|
49
|
+
Cancel
|
|
50
|
+
</button>
|
|
51
|
+
</div> </form>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
</button>
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
51
51
|
Continue
|
|
52
52
|
</button>
|
|
53
|
+
|
|
53
54
|
</form>
|
|
54
55
|
</div>
|
|
55
56
|
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
22
23
|
Continue
|
|
23
24
|
</button>
|
|
24
25
|
|
|
25
|
-
|
|
26
26
|
</form>
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
<a href="/questions/travel-companions/add/00000000-0000-0000-0000-000000000000/travel-companion-name" class="govuk-link">Add another</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
15
15
|
Continue
|
|
16
16
|
</button>
|
|
17
|
+
|
|
17
18
|
</form>
|
|
18
19
|
</div>
|
|
19
20
|
</div>
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
17
17
|
Continue
|
|
18
18
|
</button>
|
|
19
|
+
|
|
19
20
|
</form>
|
|
20
21
|
</div>
|
|
21
22
|
</div>
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
17
17
|
Continue
|
|
18
18
|
</button>
|
|
19
|
+
|
|
19
20
|
</form>
|
|
20
21
|
</div>
|
|
21
22
|
</div>
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
|
|
38
38
|
</fieldset>
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
40
|
+
<button type="submit" class="govuk-button" data-module="govuk-button" data-cy="button-save-and-continue">
|
|
42
41
|
Continue
|
|
43
42
|
</button>
|
|
43
|
+
|
|
44
44
|
</form>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
@@ -20,8 +20,9 @@ export default class BooleanQuestion extends RadioQuestion {
|
|
|
20
20
|
* @param {Array.<import('../../questions/options-question.js').Option>} [params.options]
|
|
21
21
|
* @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
|
|
22
22
|
* @param {boolean} [params.editable]
|
|
23
|
+
* @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
|
|
23
24
|
*/
|
|
24
|
-
constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable }: {
|
|
25
|
+
constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: {
|
|
25
26
|
title: string;
|
|
26
27
|
question: string;
|
|
27
28
|
fieldName: string;
|
|
@@ -34,6 +35,7 @@ export default class BooleanQuestion extends RadioQuestion {
|
|
|
34
35
|
options?: import("../../questions/options-question.js").Option[] | undefined;
|
|
35
36
|
validators?: any[] | undefined;
|
|
36
37
|
editable?: boolean | undefined;
|
|
38
|
+
viewData?: import("#question-types").QuestionParameters["viewData"];
|
|
37
39
|
});
|
|
38
40
|
interfaceType: string;
|
|
39
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/question.js"],"names":[],"mappings":"AAEA;;;GAGG;AAMI,sCAHI,MAAM,GAAC,GAAC,GACN,OAAO,CAOnB;AAEM,8DAEN;AAMM,4CAHI,OAAO,GAAC,IAAI,GACV,MAAM,GAAC,IAAI,CAOvB;AAED;IACC
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/question.js"],"names":[],"mappings":"AAEA;;;GAGG;AAMI,sCAHI,MAAM,GAAC,GAAC,GACN,OAAO,CAOnB;AAEM,8DAEN;AAMM,4CAHI,OAAO,GAAC,IAAI,GACV,MAAM,GAAC,IAAI,CAOvB;AAED;IACC;;;;;;;;;;;;;;;OAeG;IACH,6IAdG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,IAAI;QACJ,aAAa;QACyC,OAAO;QACpB,UAAU;QAClD,QAAQ;QACyC,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAmDrF;IADA,sBAAkC;IAGnC;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAe5B;CACD;0BAzHyB,sBAAsB"}
|