@ons/design-system 55.2.0 → 56.0.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.
Files changed (35) hide show
  1. package/components/button/_button.scss +48 -50
  2. package/components/button/_macro.njk +45 -19
  3. package/components/button/_macro.spec.js +24 -24
  4. package/components/button/button.spec.js +11 -11
  5. package/components/fieldset/_fieldset.scss +5 -0
  6. package/components/footer/_macro.njk +2 -6
  7. package/components/footer/_macro.spec.js +0 -6
  8. package/components/header/_macro.njk +6 -8
  9. package/components/header/_macro.spec.js +4 -8
  10. package/components/input/_macro.njk +1 -0
  11. package/components/input/_macro.spec.js +2 -0
  12. package/components/modal/_macro.njk +1 -0
  13. package/components/modal/modal.js +33 -0
  14. package/components/modal/modal.spec.js +76 -0
  15. package/components/navigation/_macro.njk +3 -2
  16. package/components/navigation/_macro.spec.js +3 -2
  17. package/components/question/_macro.njk +2 -2
  18. package/components/question/_macro.spec.js +2 -2
  19. package/components/question/_question.scss +1 -1
  20. package/components/relationships/_macro.njk +2 -1
  21. package/components/search/_macro.njk +12 -2
  22. package/components/search/_macro.spec.js +27 -2
  23. package/components/summary/_macro.njk +23 -29
  24. package/components/summary/_macro.spec.js +38 -38
  25. package/components/summary/_summary.scss +41 -10
  26. package/components/timeout-modal/_macro.njk +1 -0
  27. package/components/timeout-modal/timeout-modal.js +1 -1
  28. package/components/timeout-modal/timeout-modal.spec.js +68 -0
  29. package/css/census.css +1 -1
  30. package/css/ids.css +1 -1
  31. package/css/main.css +1 -1
  32. package/package.json +1 -1
  33. package/scripts/main.es5.js +1 -1
  34. package/scripts/main.js +1 -1
  35. package/scss/patternlib.scss +2 -2
@@ -8,6 +8,9 @@ $hub-row-spacing: 1.3rem;
8
8
  &__items {
9
9
  border-collapse: collapse;
10
10
  border-spacing: 0;
11
+ display: flex;
12
+ flex-direction: column;
13
+ margin: 0;
11
14
  width: 100%;
12
15
 
13
16
  + .ons-summary__group-title {
@@ -15,6 +18,11 @@ $hub-row-spacing: 1.3rem;
15
18
  }
16
19
  }
17
20
 
21
+ &__row {
22
+ display: flex;
23
+ margin: 0;
24
+ }
25
+
18
26
  &__item {
19
27
  line-height: 1.4;
20
28
 
@@ -28,6 +36,10 @@ $hub-row-spacing: 1.3rem;
28
36
 
29
37
  border-width: 2px;
30
38
  font-weight: 700;
39
+
40
+ .ons-summary__values {
41
+ padding-top: 23px;
42
+ }
31
43
  }
32
44
 
33
45
  &--error {
@@ -39,12 +51,17 @@ $hub-row-spacing: 1.3rem;
39
51
  &__row-title {
40
52
  padding: $summary-row-spacing 0;
41
53
  text-align: left;
54
+
55
+ &--no-group-title {
56
+ padding-top: 0;
57
+ }
42
58
  }
43
59
 
44
60
  &__item-title,
45
61
  &__values,
46
62
  &__actions {
47
63
  hyphens: manual;
64
+ margin: 0;
48
65
  overflow-wrap: break-word;
49
66
  padding: 0 0 $summary-row-spacing;
50
67
  vertical-align: top;
@@ -90,12 +107,13 @@ $hub-row-spacing: 1.3rem;
90
107
  }
91
108
 
92
109
  &__item--error & {
93
- &__row-title {
110
+ &__row-title--error {
94
111
  color: $color-errors;
95
112
  font-weight: 700;
96
113
  padding: $summary-row-spacing $summary-col-spacing;
97
114
  }
98
115
 
116
+ &__row-title,
99
117
  &__item-title,
100
118
  &__values,
101
119
  &__actions {
@@ -106,7 +124,8 @@ $hub-row-spacing: 1.3rem;
106
124
  padding-left: math.div($summary-col-spacing, 2);
107
125
  padding-right: math.div($summary-col-spacing, 2);
108
126
 
109
- &:first-child {
127
+ &:first-child,
128
+ & {
110
129
  padding-left: $summary-col-spacing;
111
130
  }
112
131
 
@@ -137,7 +156,7 @@ $hub-row-spacing: 1.3rem;
137
156
  }
138
157
 
139
158
  // Breakpoints
140
- @include mq(xxs, s, none, '<') {
159
+ @include mq(xxs, m, none, '<') {
141
160
  &__item-title,
142
161
  &__values,
143
162
  &__actions {
@@ -149,12 +168,17 @@ $hub-row-spacing: 1.3rem;
149
168
  display: none;
150
169
  }
151
170
  }
171
+
172
+ &__row {
173
+ flex-direction: column;
174
+ }
152
175
  }
153
176
 
154
- @include mq(s) {
177
+ @include mq(m) {
155
178
  &__item-title,
156
179
  &__values,
157
180
  &__actions {
181
+ flex: 2;
158
182
  padding-top: $summary-row-spacing;
159
183
  vertical-align: top;
160
184
 
@@ -164,14 +188,17 @@ $hub-row-spacing: 1.3rem;
164
188
  }
165
189
 
166
190
  &__actions {
167
- text-align: right;
191
+ display: flex;
192
+ justify-content: right;
168
193
  }
169
194
 
170
- &__row--has-values & {
171
- &__item-title,
172
- &__values {
173
- width: 50%;
174
- }
195
+ &__item-title,
196
+ &__values {
197
+ flex: 6.19;
198
+ }
199
+
200
+ &__item-title--2 {
201
+ flex: 4.5;
175
202
  }
176
203
 
177
204
  &--hub & {
@@ -180,6 +207,10 @@ $hub-row-spacing: 1.3rem;
180
207
  &__actions {
181
208
  padding-top: $hub-row-spacing;
182
209
  }
210
+
211
+ &__actions {
212
+ flex: 6;
213
+ }
183
214
  }
184
215
  }
185
216
  }
@@ -4,6 +4,7 @@
4
4
  "title": params.title,
5
5
  "btnText": params.btnText,
6
6
  "classes": "ons-js-timeout-modal",
7
+ "enableGA": params.enableGA,
7
8
  "attributes": {
8
9
  "data-redirect-url": params.redirectUrl,
9
10
  "data-server-session-expires-at": params.sessionExpiresAt,
@@ -73,7 +73,7 @@ export default class TimeoutModal {
73
73
  time = false;
74
74
  }
75
75
  if (this.modal.isDialogOpen()) {
76
- this.modal.closeDialog();
76
+ this.modal.closeDialog(event);
77
77
  }
78
78
  await this.timeout.restartTimeout(time);
79
79
  this.startTimeout();
@@ -223,4 +223,72 @@ describe('script: timeout modal', () => {
223
223
  });
224
224
  });
225
225
  });
226
+
227
+ describe('when GA tracking is enabled', () => {
228
+ beforeEach(async () => {
229
+ const component = renderComponent('timeout-modal', {
230
+ ...EXAMPLE_TIMEOUT_MODAL_BASIC,
231
+ showModalTimeInSeconds: 59,
232
+ enableGA: true,
233
+ });
234
+
235
+ const template = `
236
+ <div class="ons-page">
237
+ ${component}
238
+ </div>
239
+ `;
240
+
241
+ await setTestPage('/test', template);
242
+ });
243
+
244
+ describe('when the modal is open', () => {
245
+ beforeEach(async () => {
246
+ await page.waitForSelector('.ons-modal');
247
+ await page.waitForTimeout(1000);
248
+ });
249
+
250
+ it('has the correct attributes set on the modal', async () => {
251
+ const gaLabel = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-label'));
252
+ const gaAction = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-action'));
253
+ const gaCategory = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-category'));
254
+ expect(gaLabel).toBe('Timeout modal opened');
255
+ expect(gaAction).toBe('Modal opened by timed event');
256
+ expect(gaCategory).toBe('Timeout modal');
257
+ });
258
+ });
259
+
260
+ describe('when the modal is closed by a click event', () => {
261
+ beforeEach(async () => {
262
+ await page.waitForSelector('.ons-modal');
263
+ await page.waitForTimeout(1000);
264
+ await page.click('.ons-js-modal-btn');
265
+ });
266
+
267
+ it('has the correct attributes set on the modal', async () => {
268
+ const gaLabel = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-label'));
269
+ const gaAction = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-action'));
270
+ const gaCategory = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-category'));
271
+ expect(gaLabel).toBe('Timeout modal closed');
272
+ expect(gaAction).toBe('Modal closed by click event');
273
+ expect(gaCategory).toBe('Timeout modal');
274
+ });
275
+ });
276
+
277
+ describe('when the modal is closed by `escape` keypress event', () => {
278
+ beforeEach(async () => {
279
+ await page.waitForSelector('.ons-modal');
280
+ await page.waitForTimeout(1000);
281
+ await page.keyboard.press('Escape');
282
+ });
283
+
284
+ it('has the correct attributes set on the modal', async () => {
285
+ const gaLabel = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-label'));
286
+ const gaAction = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-action'));
287
+ const gaCategory = await page.$eval('.ons-modal', node => node.getAttribute('data-ga-category'));
288
+ expect(gaLabel).toBe('Timeout modal closed');
289
+ expect(gaAction).toBe('Modal closed by keydown event');
290
+ expect(gaCategory).toBe('Timeout modal');
291
+ });
292
+ });
293
+ });
226
294
  });