@ons/design-system 65.2.2 → 65.2.3

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.
@@ -13,11 +13,11 @@
13
13
  "itemsList": [
14
14
  {
15
15
  "url": '#0',
16
- "text": 'List item 1'
16
+ "text": 'List item 1 about the census'
17
17
  },
18
18
  {
19
19
  "url": '#0',
20
- "text": 'List item 2'
20
+ "text": 'List item 2 about the census'
21
21
  }
22
22
  ]
23
23
  }) }}
@@ -33,11 +33,11 @@
33
33
  "itemsList": [
34
34
  {
35
35
  "url": '#0',
36
- "text": 'List item 1'
36
+ "text": 'List item 1 about working on the census'
37
37
  },
38
38
  {
39
39
  "url": '#0',
40
- "text": 'List item 2'
40
+ "text": 'List item 2 about working on the census'
41
41
  }
42
42
  ]
43
43
  }) }}
@@ -53,11 +53,11 @@
53
53
  "itemsList": [
54
54
  {
55
55
  "url": '#0',
56
- "text": 'List item 1'
56
+ "text": 'List item 1 about your data and security'
57
57
  },
58
58
  {
59
59
  "url": '#0',
60
- "text": 'List item 2'
60
+ "text": 'List item 2 about your data and security'
61
61
  }
62
62
  ]
63
63
  }) }}
@@ -1,8 +1,9 @@
1
- import puppeteer from 'puppeteer';
2
-
1
+ import { KnownDevices } from 'puppeteer';
3
2
  import { setViewport } from '../../tests/helpers/puppeteer';
4
3
  import { renderComponent, renderTemplate, setTestPage } from '../../tests/helpers/rendering';
5
4
 
5
+ const iPhoneX = KnownDevices['iPhone X'];
6
+
6
7
  const EXAMPLE_PAGE = `
7
8
  <div class="ons-page">
8
9
  <div class="ons-js-adv-filter">
@@ -199,12 +200,12 @@ describe('script: download-resources', () => {
199
200
  });
200
201
 
201
202
  it('updates result count text', async () => {
202
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
203
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
203
204
  expect(resultsCount).toBe('3');
204
205
  });
205
206
 
206
207
  it('hides the "No results" content', async () => {
207
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
208
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
208
209
  expect(isHidden).toBe(true);
209
210
  });
210
211
  });
@@ -226,12 +227,12 @@ describe('script: download-resources', () => {
226
227
  });
227
228
 
228
229
  it('updates result count text', async () => {
229
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
230
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
230
231
  expect(resultsCount).toBe('0');
231
232
  });
232
233
 
233
234
  it('shows the "No results" content', async () => {
234
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
235
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
235
236
  expect(isHidden).toBe(false);
236
237
  });
237
238
  });
@@ -253,12 +254,12 @@ describe('script: download-resources', () => {
253
254
  });
254
255
 
255
256
  it('updates result count text', async () => {
256
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
257
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
257
258
  expect(resultsCount).toBe('2');
258
259
  });
259
260
 
260
261
  it('hides the "No results" content', async () => {
261
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
262
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
262
263
  expect(isHidden).toBe(true);
263
264
  });
264
265
  });
@@ -281,12 +282,12 @@ describe('script: download-resources', () => {
281
282
  });
282
283
 
283
284
  it('updates result count text', async () => {
284
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
285
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
285
286
  expect(resultsCount).toBe('3');
286
287
  });
287
288
 
288
289
  it('hides the "No results" content', async () => {
289
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
290
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
290
291
  expect(isHidden).toBe(true);
291
292
  });
292
293
  });
@@ -309,12 +310,12 @@ describe('script: download-resources', () => {
309
310
  });
310
311
 
311
312
  it('updates result count text', async () => {
312
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
313
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
313
314
  expect(resultsCount).toBe('0');
314
315
  });
315
316
 
316
317
  it('shows the "No results" content', async () => {
317
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
318
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
318
319
  expect(isHidden).toBe(false);
319
320
  });
320
321
  });
@@ -337,12 +338,12 @@ describe('script: download-resources', () => {
337
338
  });
338
339
 
339
340
  it('updates result count text', async () => {
340
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
341
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
341
342
  expect(resultsCount).toBe('2');
342
343
  });
343
344
 
344
345
  it('hides the "No results" content', async () => {
345
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
346
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
346
347
  expect(isHidden).toBe(true);
347
348
  });
348
349
  });
@@ -365,12 +366,12 @@ describe('script: download-resources', () => {
365
366
  });
366
367
 
367
368
  it('updates result count text', async () => {
368
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
369
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
369
370
  expect(resultsCount).toBe('1');
370
371
  });
371
372
 
372
373
  it('hides the "No results" content', async () => {
373
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
374
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
374
375
  expect(isHidden).toBe(true);
375
376
  });
376
377
  });
@@ -394,12 +395,12 @@ describe('script: download-resources', () => {
394
395
  });
395
396
 
396
397
  it('updates result count text', async () => {
397
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
398
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
398
399
  expect(resultsCount).toBe('2');
399
400
  });
400
401
 
401
402
  it('hides the "No results" content', async () => {
402
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
403
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
403
404
  expect(isHidden).toBe(true);
404
405
  });
405
406
  });
@@ -432,7 +433,7 @@ describe('script: download-resources', () => {
432
433
 
433
434
  it('resets state of all filter checkboxes ', async () => {
434
435
  const selector = '.ons-js-adv-filter__item .ons-js-checkbox';
435
- const checkboxStates = await page.$$eval(selector, nodes => nodes.map(node => `${node.id}: ${node.checked}`));
436
+ const checkboxStates = await page.$$eval(selector, (nodes) => nodes.map((node) => `${node.id}: ${node.checked}`));
436
437
 
437
438
  expect(checkboxStates).toEqual(['community-groups: false', 'general-public: false', 'booklet: false', 'logo: false']);
438
439
  });
@@ -448,12 +449,12 @@ describe('script: download-resources', () => {
448
449
  });
449
450
 
450
451
  it('updates result count text', async () => {
451
- const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', node => node.textContent.trim());
452
+ const resultsCount = await page.$eval('.ons-js-adv-filter__results-count', (node) => node.textContent.trim());
452
453
  expect(resultsCount).toBe('3');
453
454
  });
454
455
 
455
456
  it('hides the "No results" content', async () => {
456
- const isHidden = await page.$eval('.ons-adv-filter__no-results', node => node.classList.contains('ons-u-hidden'));
457
+ const isHidden = await page.$eval('.ons-adv-filter__no-results', (node) => node.classList.contains('ons-u-hidden'));
457
458
  expect(isHidden).toBe(true);
458
459
  });
459
460
  });
@@ -470,19 +471,19 @@ describe('script: download-resources', () => {
470
471
  });
471
472
 
472
473
  it('hides elements that are only needed for mobile', async () => {
473
- const displayStyle = await page.$eval('.ons-adv-filter__trigger', node => getComputedStyle(node).display);
474
+ const displayStyle = await page.$eval('.ons-adv-filter__trigger', (node) => getComputedStyle(node).display);
474
475
  expect(displayStyle).toBe('none');
475
476
  });
476
477
 
477
478
  it('shows filter elements', async () => {
478
- const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
479
+ const displayStyle = await page.$eval('.ons-adv-filter__panel', (node) => getComputedStyle(node).display);
479
480
  expect(displayStyle).not.toBe('none');
480
481
  });
481
482
  });
482
483
 
483
484
  describe('when the viewport is small', () => {
484
485
  beforeEach(async () => {
485
- await page.emulate(puppeteer.devices['iPhone X']);
486
+ await page.emulate(iPhoneX);
486
487
  await setTestPage('/test', RENDERED_EXAMPLE_PAGE);
487
488
  });
488
489
 
@@ -492,27 +493,27 @@ describe('script: download-resources', () => {
492
493
  });
493
494
 
494
495
  it('shows elements that are only needed for mobile', async () => {
495
- const displayStyle = await page.$eval('.ons-adv-filter__trigger', node => getComputedStyle(node).display);
496
+ const displayStyle = await page.$eval('.ons-adv-filter__trigger', (node) => getComputedStyle(node).display);
496
497
  expect(displayStyle).not.toBe('none');
497
498
  });
498
499
 
499
500
  it('hides filter elements', async () => {
500
- const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
501
+ const displayStyle = await page.$eval('.ons-adv-filter__panel', (node) => getComputedStyle(node).display);
501
502
  expect(displayStyle).toBe('none');
502
503
  });
503
504
 
504
505
  it('shows filter elements when the "Show filters" button is pressed', async () => {
505
506
  await page.click('.ons-js-adv-filter__trigger');
506
507
 
507
- const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
508
+ const displayStyle = await page.$eval('.ons-adv-filter__panel', (node) => getComputedStyle(node).display);
508
509
  expect(displayStyle).not.toBe('none');
509
510
  });
510
511
 
511
512
  it('hides the underlying page elements when the "Show filters" button is pressed', async () => {
512
513
  await page.click('.ons-js-adv-filter__trigger');
513
514
 
514
- const pageIsHidden = await page.$eval('.ons-page', node => node.classList.contains('ons-u-d-no'));
515
- const pageIsAriaHidden = await page.$eval('.ons-page', node => node.getAttribute('aria-hidden'));
515
+ const pageIsHidden = await page.$eval('.ons-page', (node) => node.classList.contains('ons-u-d-no'));
516
+ const pageIsAriaHidden = await page.$eval('.ons-page', (node) => node.getAttribute('aria-hidden'));
516
517
 
517
518
  expect(pageIsHidden).toBe(true);
518
519
  expect(pageIsAriaHidden).toBe('true');
@@ -522,7 +523,7 @@ describe('script: download-resources', () => {
522
523
  await page.click('.ons-js-adv-filter__trigger');
523
524
  await page.click('.ons-js-adv-filter__show');
524
525
 
525
- const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
526
+ const displayStyle = await page.$eval('.ons-adv-filter__panel', (node) => getComputedStyle(node).display);
526
527
  expect(displayStyle).toBe('none');
527
528
  });
528
529
 
@@ -530,8 +531,8 @@ describe('script: download-resources', () => {
530
531
  await page.click('.ons-js-adv-filter__trigger');
531
532
  await page.click('.ons-js-adv-filter__show');
532
533
 
533
- const pageIsHidden = await page.$eval('.ons-page', node => node.classList.contains('ons-u-d-no'));
534
- const pageIsAriaHidden = await page.$eval('.ons-page', node => node.getAttribute('aria-hidden'));
534
+ const pageIsHidden = await page.$eval('.ons-page', (node) => node.classList.contains('ons-u-d-no'));
535
+ const pageIsAriaHidden = await page.$eval('.ons-page', (node) => node.getAttribute('aria-hidden'));
535
536
 
536
537
  expect(pageIsHidden).toBe(false);
537
538
  expect(pageIsAriaHidden).toBe('false');
@@ -541,7 +542,7 @@ describe('script: download-resources', () => {
541
542
  await page.click('.ons-js-adv-filter__trigger');
542
543
  await page.click('.ons-js-adv-filter__close');
543
544
 
544
- const displayStyle = await page.$eval('.ons-adv-filter__panel', node => getComputedStyle(node).display);
545
+ const displayStyle = await page.$eval('.ons-adv-filter__panel', (node) => getComputedStyle(node).display);
545
546
  expect(displayStyle).toBe('none');
546
547
  });
547
548
 
@@ -549,8 +550,8 @@ describe('script: download-resources', () => {
549
550
  await page.click('.ons-js-adv-filter__trigger');
550
551
  await page.click('.ons-js-adv-filter__close');
551
552
 
552
- const pageIsHidden = await page.$eval('.ons-page', node => node.classList.contains('ons-u-d-no'));
553
- const pageIsAriaHidden = await page.$eval('.ons-page', node => node.getAttribute('aria-hidden'));
553
+ const pageIsHidden = await page.$eval('.ons-page', (node) => node.classList.contains('ons-u-d-no'));
554
+ const pageIsAriaHidden = await page.$eval('.ons-page', (node) => node.getAttribute('aria-hidden'));
554
555
 
555
556
  expect(pageIsHidden).toBe(false);
556
557
  expect(pageIsAriaHidden).toBe('false');
@@ -559,7 +560,7 @@ describe('script: download-resources', () => {
559
560
  });
560
561
 
561
562
  async function getTextContent(page, selector) {
562
- return await page.$$eval(selector, nodes => nodes.map(node => node.textContent.trim()));
563
+ return await page.$$eval(selector, (nodes) => nodes.map((node) => node.textContent.trim()));
563
564
  }
564
565
 
565
566
  async function getFilterSelectionLabels(page) {
@@ -11,7 +11,7 @@
11
11
  {% if params.noInitialActiveTab %}data-no-initial-active-tab="true"{% endif %}
12
12
  >
13
13
  {% set titleTag = params.titleTag | default("h2") %}
14
- <{{ titleTag }} class="ons-tabs__title ons-u-fs-r--b ons-u-mt-no">{{ params.title }}</{{ titleTag }}>
14
+ <{{ titleTag }} class="ons-tabs__title ons-u-fs-r--b ons-u-mt-no{% if params.titleClasses %} {{ params.titleClasses }}{% endif %}">{{ params.title }}</{{ titleTag }}>
15
15
  <div>
16
16
  <ul class="ons-tabs__list">
17
17
  {%- for tab in params.tabs -%}
@@ -3,6 +3,7 @@
3
3
  {{
4
4
  onsTabs({
5
5
  "title": 'Contents',
6
+ "titleClasses": 'ons-u-fs-m',
6
7
  "tabs": [
7
8
  {
8
9
  "id": "ukis",
@@ -1,10 +1,12 @@
1
- import puppeteer from 'puppeteer';
2
-
1
+ import { KnownDevices } from 'puppeteer';
3
2
  import { setViewport } from '../../tests/helpers/puppeteer';
4
3
  import { renderComponent, setTestPage } from '../../tests/helpers/rendering';
5
4
 
5
+ const iPhoneX = KnownDevices['iPhone X'];
6
+
6
7
  const EXAMPLE_TABS = {
7
8
  title: 'Example tabs',
9
+ titleClasses: 'ons-u-fs-m',
8
10
  tabs: [
9
11
  {
10
12
  id: 'tab.id.1',
@@ -74,44 +76,50 @@ describe('script: tabs', () => {
74
76
  await setTestPage('/test', renderComponent('tabs', EXAMPLE_TABS));
75
77
  });
76
78
 
79
+ it('has additionally provided `titleClasses`', async () => {
80
+ const hasClass = await page.$eval('.ons-tabs__title', (node) => node.classList.contains('ons-u-fs-m'));
81
+
82
+ expect(hasClass).toBe(true);
83
+ });
84
+
77
85
  it('has the "presentation" role assigned to tab list items', async () => {
78
- const role = await page.$eval('.ons-tab__list-item', node => node.getAttribute('role'));
86
+ const role = await page.$eval('.ons-tab__list-item', (node) => node.getAttribute('role'));
79
87
  expect(role).toBe('presentation');
80
88
  });
81
89
 
82
90
  it('has the "tab" role assigned to each tab', async () => {
83
- const tabRoleValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('role')));
91
+ const tabRoleValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('role')));
84
92
 
85
93
  expect(tabRoleValues).toEqual(['tab', 'tab', 'tab']);
86
94
  });
87
95
 
88
96
  it('has "aria-controls" assigned to each tab with the corresponding panel id', async () => {
89
- const ariaControlsValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('aria-controls')));
97
+ const ariaControlsValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('aria-controls')));
90
98
 
91
99
  expect(ariaControlsValues).toEqual(['tab.id.1', 'tab.id.2', 'tab.id.3']);
92
100
  });
93
101
 
94
102
  it('has "aria-selected" assigned to the first tab', async () => {
95
- const ariaSelectedValue = await page.$eval('.ons-tab', node => node.getAttribute('aria-selected'));
103
+ const ariaSelectedValue = await page.$eval('.ons-tab', (node) => node.getAttribute('aria-selected'));
96
104
 
97
105
  expect(ariaSelectedValue).toBe('true');
98
106
  });
99
107
 
100
108
  it('has the "ons-tab--selected" class assigned to the first tab', async () => {
101
- const hasClass = await page.$eval('.ons-tab', node => node.classList.contains('ons-tab--selected'));
109
+ const hasClass = await page.$eval('.ons-tab', (node) => node.classList.contains('ons-tab--selected'));
102
110
 
103
111
  expect(hasClass).toBe(true);
104
112
  });
105
113
 
106
114
  it('has "tabindex" assigned to each tab', async () => {
107
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
115
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
108
116
 
109
117
  expect(tabIndexValues).toEqual(['0', '-1', '-1']);
110
118
  });
111
119
 
112
120
  it('has only one visible tab panel', async () => {
113
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
114
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
121
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
122
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
115
123
  );
116
124
 
117
125
  expect(panelHiddenStates).toEqual([false, true, true]);
@@ -124,26 +132,26 @@ describe('script: tabs', () => {
124
132
  });
125
133
 
126
134
  it('is assigned a "tabindex" value', async () => {
127
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
135
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
128
136
 
129
137
  expect(tabIndexValues).toEqual(['-1', '0', '-1']);
130
138
  });
131
139
 
132
140
  it('has the "aria-selected" attribute', async () => {
133
- const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', node => node.getAttribute('aria-selected'));
141
+ const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', (node) => node.getAttribute('aria-selected'));
134
142
 
135
143
  expect(ariaSelectedValue).toBe('true');
136
144
  });
137
145
 
138
146
  it('has the "ons-tab--selected" class assigned', async () => {
139
- const hasClass = await page.$eval('a[href="#tab.id.2"]', node => node.classList.contains('ons-tab--selected'));
147
+ const hasClass = await page.$eval('a[href="#tab.id.2"]', (node) => node.classList.contains('ons-tab--selected'));
140
148
 
141
149
  expect(hasClass).toBe(true);
142
150
  });
143
151
 
144
152
  it('shows the corresponding panel', async () => {
145
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
146
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
153
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
154
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
147
155
  );
148
156
 
149
157
  expect(panelHiddenStates).toEqual([true, false, true]);
@@ -178,26 +186,26 @@ describe('script: tabs', () => {
178
186
  });
179
187
 
180
188
  it('is assigned a "tabindex" value', async () => {
181
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
189
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
182
190
 
183
191
  expect(tabIndexValues).toEqual(['-1', '0', '-1']);
184
192
  });
185
193
 
186
194
  it('has the "aria-selected" attribute', async () => {
187
- const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', node => node.getAttribute('aria-selected'));
195
+ const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', (node) => node.getAttribute('aria-selected'));
188
196
 
189
197
  expect(ariaSelectedValue).toBe('true');
190
198
  });
191
199
 
192
200
  it('has the "ons-tab--selected" class assigned', async () => {
193
- const hasClass = await page.$eval('a[href="#tab.id.2"]', node => node.classList.contains('ons-tab--selected'));
201
+ const hasClass = await page.$eval('a[href="#tab.id.2"]', (node) => node.classList.contains('ons-tab--selected'));
194
202
 
195
203
  expect(hasClass).toBe(true);
196
204
  });
197
205
 
198
206
  it('shows the corresponding panel', async () => {
199
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
200
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
207
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
208
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
201
209
  );
202
210
 
203
211
  expect(panelHiddenStates).toEqual([true, false, true]);
@@ -206,7 +214,7 @@ describe('script: tabs', () => {
206
214
 
207
215
  describe('when the viewport is small', () => {
208
216
  beforeEach(async () => {
209
- await page.emulate(puppeteer.devices['iPhone X']);
217
+ await page.emulate(iPhoneX);
210
218
 
211
219
  await setTestPage('/test', renderComponent('tabs', EXAMPLE_TABS_LONGER));
212
220
  });
@@ -214,27 +222,27 @@ describe('script: tabs', () => {
214
222
  it('has no aria attributes on tabs', async () => {
215
223
  const tabElements = await page.$$('.ons-tab');
216
224
  for (let i = 0; i < 3; ++i) {
217
- const hasRoleAttribute = await tabElements[i].evaluate(node => node.getAttribute('role') !== null);
225
+ const hasRoleAttribute = await tabElements[i].evaluate((node) => node.getAttribute('role') !== null);
218
226
  expect(hasRoleAttribute).toBe(false);
219
227
 
220
- const hasAriaControlsAttribute = await tabElements[i].evaluate(node => node.getAttribute('aria-controls') !== null);
228
+ const hasAriaControlsAttribute = await tabElements[i].evaluate((node) => node.getAttribute('aria-controls') !== null);
221
229
  expect(hasAriaControlsAttribute).toBe(false);
222
230
 
223
- const hasAriaSelectedAttribute = await tabElements[i].evaluate(node => node.getAttribute('aria-selected') !== null);
231
+ const hasAriaSelectedAttribute = await tabElements[i].evaluate((node) => node.getAttribute('aria-selected') !== null);
224
232
  expect(hasAriaSelectedAttribute).toBe(false);
225
233
  }
226
234
  });
227
235
 
228
236
  it('has no hidden tab panels', async () => {
229
- const panelCount = await page.$$eval('.ons-tabs__panel', nodes => nodes.length);
237
+ const panelCount = await page.$$eval('.ons-tabs__panel', (nodes) => nodes.length);
230
238
  expect(panelCount).toBe(5);
231
239
 
232
- const hiddenPanelCount = await page.$$eval('.ons-tabs__panel--hidden', nodes => nodes.length);
240
+ const hiddenPanelCount = await page.$$eval('.ons-tabs__panel--hidden', (nodes) => nodes.length);
233
241
  expect(hiddenPanelCount).toBe(0);
234
242
  });
235
243
 
236
244
  it('displays a h2 element with a unique id', async () => {
237
- const panelCount = await page.$$eval('#tab-1-content-title', nodes => nodes.length);
245
+ const panelCount = await page.$$eval('#tab-1-content-title', (nodes) => nodes.length);
238
246
  expect(panelCount).toBe(1);
239
247
  });
240
248
  });
@@ -246,13 +254,13 @@ describe('script: tabs', () => {
246
254
  });
247
255
 
248
256
  it('does not assign "aria-selected" to the first tab', async () => {
249
- const ariaSelectedValue = await page.$eval('.ons-tab', node => node.getAttribute('aria-selected'));
257
+ const ariaSelectedValue = await page.$eval('.ons-tab', (node) => node.getAttribute('aria-selected'));
250
258
 
251
259
  expect(ariaSelectedValue).not.toBe('true');
252
260
  });
253
261
 
254
262
  it('does not assign the "ons-tab--selected" class to the first tab', async () => {
255
- const hasClass = await page.$eval('.ons-tab', node => node.classList.contains('ons-tab--selected'));
263
+ const hasClass = await page.$eval('.ons-tab', (node) => node.classList.contains('ons-tab--selected'));
256
264
 
257
265
  expect(hasClass).toBe(false);
258
266
  });
@@ -264,26 +272,26 @@ describe('script: tabs', () => {
264
272
  });
265
273
 
266
274
  it('is assigned a "tabindex" value', async () => {
267
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
275
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
268
276
 
269
277
  expect(tabIndexValues).toEqual(['0', '-1', '-1']);
270
278
  });
271
279
 
272
280
  it('has the "aria-selected" attribute', async () => {
273
- const ariaSelectedValue = await page.$eval('a[href="#tab.id.1"]', node => node.getAttribute('aria-selected'));
281
+ const ariaSelectedValue = await page.$eval('a[href="#tab.id.1"]', (node) => node.getAttribute('aria-selected'));
274
282
 
275
283
  expect(ariaSelectedValue).toBe('true');
276
284
  });
277
285
 
278
286
  it('has the "ons-tab--selected" class assigned', async () => {
279
- const hasClass = await page.$eval('a[href="#tab.id.1"]', node => node.classList.contains('ons-tab--selected'));
287
+ const hasClass = await page.$eval('a[href="#tab.id.1"]', (node) => node.classList.contains('ons-tab--selected'));
280
288
 
281
289
  expect(hasClass).toBe(true);
282
290
  });
283
291
 
284
292
  it('shows the corresponding panel', async () => {
285
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
286
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
293
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
294
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
287
295
  );
288
296
 
289
297
  expect(panelHiddenStates).toEqual([false, true, true]);
@@ -298,26 +306,26 @@ describe('script: tabs', () => {
298
306
  });
299
307
 
300
308
  it('is assigned a "tabindex" value', async () => {
301
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
309
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
302
310
 
303
311
  expect(tabIndexValues).toEqual(['0', '-1', '-1']);
304
312
  });
305
313
 
306
314
  it('does not have the "aria-selected" attribute', async () => {
307
- const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', node => node.getAttribute('aria-selected'));
315
+ const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', (node) => node.getAttribute('aria-selected'));
308
316
 
309
317
  expect(ariaSelectedValue).not.toBe('true');
310
318
  });
311
319
 
312
320
  it('does not have the "ons-tab--selected" class assigned', async () => {
313
- const hasClass = await page.$eval('a[href="#tab.id.2"]', node => node.classList.contains('ons-tab--selected'));
321
+ const hasClass = await page.$eval('a[href="#tab.id.2"]', (node) => node.classList.contains('ons-tab--selected'));
314
322
 
315
323
  expect(hasClass).toBe(false);
316
324
  });
317
325
 
318
326
  it('hides the corresponding panel', async () => {
319
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
320
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
327
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
328
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
321
329
  );
322
330
 
323
331
  expect(panelHiddenStates).toEqual([true, true, true]);
@@ -332,26 +340,26 @@ describe('script: tabs', () => {
332
340
  });
333
341
 
334
342
  it('is assigned a "tabindex" value', async () => {
335
- const tabIndexValues = await page.$$eval('.ons-tab', nodes => nodes.map(node => node.getAttribute('tabindex')));
343
+ const tabIndexValues = await page.$$eval('.ons-tab', (nodes) => nodes.map((node) => node.getAttribute('tabindex')));
336
344
 
337
345
  expect(tabIndexValues).toEqual(['-1', '0', '-1']);
338
346
  });
339
347
 
340
348
  it('has the "aria-selected" attribute', async () => {
341
- const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', node => node.getAttribute('aria-selected'));
349
+ const ariaSelectedValue = await page.$eval('a[href="#tab.id.2"]', (node) => node.getAttribute('aria-selected'));
342
350
 
343
351
  expect(ariaSelectedValue).toBe('true');
344
352
  });
345
353
 
346
354
  it('has the "ons-tab--selected" class assigned', async () => {
347
- const hasClass = await page.$eval('a[href="#tab.id.2"]', node => node.classList.contains('ons-tab--selected'));
355
+ const hasClass = await page.$eval('a[href="#tab.id.2"]', (node) => node.classList.contains('ons-tab--selected'));
348
356
 
349
357
  expect(hasClass).toBe(true);
350
358
  });
351
359
 
352
360
  it('shows the corresponding panel', async () => {
353
- const panelHiddenStates = await page.$$eval('.ons-tabs__panel', nodes =>
354
- nodes.map(node => node.classList.contains('ons-tabs__panel--hidden')),
361
+ const panelHiddenStates = await page.$$eval('.ons-tabs__panel', (nodes) =>
362
+ nodes.map((node) => node.classList.contains('ons-tabs__panel--hidden')),
355
363
  );
356
364
 
357
365
  expect(panelHiddenStates).toEqual([true, false, true]);
@@ -14,8 +14,9 @@
14
14
  {% if pageConfig.cdn or release_version or designSystemVersion %}
15
15
  {# Production #}
16
16
  {% set cdn_url = (pageConfig.cdn.url if pageConfig.cdn and pageConfig.cdn.url) or "https://cdn.ons.gov.uk/sdc/design-system" %}
17
- {% set slash = "" if cdn_url | last == "/" else "/" %}
18
- {% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn and pageConfig.cdn.version) or release_version or designSystemVersion) %}
17
+ {% set slash = "" if cdn_url | last == "/" else
18
+ "/" %}
19
+ {% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn and pageConfig.cdn.version)or release_version or designSystemVersion) %}
19
20
  {% elif pageConfig.assetsURL %}
20
21
  {# Runner Dev #}
21
22
  {% set assetsURL = pageConfig.assetsURL %}
@@ -43,9 +44,12 @@
43
44
 
44
45
  {# Page columns #}
45
46
  {% set pageColNumber = pageConfig.pageColNumber | default("12") %}
46
- {% set pageColClasses = pageConfig.pageColClasses if pageConfig.pageColClasses else '' %}
47
- {% set mainClasses = pageConfig.mainColClasses if pageConfig.mainColClasses else '' %}
48
-
47
+ {% set pageColClasses = pageConfig.pageColClasses if pageConfig.pageColClasses else
48
+ '' %}
49
+ {% set mainClasses = pageConfig.mainColClasses if pageConfig.mainColClasses else
50
+ '' %}
51
+ {% set themeColor = pageConfig.themeColor if pageConfig.themeColor else
52
+ "#206095" %}
49
53
  <!doctype html>
50
54
  <html lang="{{ currentLanguageISOCode }}">
51
55
  <head>
@@ -55,7 +59,7 @@
55
59
  <title>{{ page_title }}</title>
56
60
  <link rel="stylesheet" href="{{ assetsURL }}/css/main.css">
57
61
  <link rel="stylesheet" media="print" href="{{ assetsURL }}/css/print.css">
58
- <meta name="theme-color" content="#206095"/>
62
+ <meta name="theme-color" content="{{ themeColor }}"/>
59
63
  {% block meta %}
60
64
  {% if pageConfig.meta %}
61
65
  {% if pageConfig.meta.description or pageConfig.description %}
@@ -87,12 +91,13 @@
87
91
  <meta property="og:locale" content="{{ currentLanguageISOCode }}">
88
92
 
89
93
  {% if otherLanguageISOCode %}
90
- <meta property="og:locale:alternate" content="{{ otherLanguageISOCode }}">
94
+ <meta property="og:locale:alternate" content="{{ otherLanguageISOCode }}">
91
95
  {% endif %}
92
96
 
93
97
  {% if pageConfig.social %}
94
98
 
95
- {% set twitterImagePath = pageConfig.social.twitterImage if pageConfig.social.twitterImage else assetsURL + '/favicons/twitter.png' %}
99
+ {% set twitterImagePath = pageConfig.social.twitterImage if pageConfig.social.twitterImage else
100
+ assetsURL + '/favicons/twitter.png' %}
96
101
  <!-- Twitter -->
97
102
  <meta name="twitter:card" content="summary">
98
103
  <meta name="twitter:site" content="{{ pageConfig.social.twitterSite }}">
@@ -132,37 +137,37 @@
132
137
  {% block preHeader %}{% endblock %}
133
138
  {% block skipLink %}
134
139
  {{
135
- onsSkipToContent({
136
- "url": "#main-content",
137
- "text": "Skip to main content"
138
- })
139
- }}
140
+ onsSkipToContent({
141
+ "url": "#main-content",
142
+ "text": "Skip to main content"
143
+ })
144
+ }}
140
145
  {% endblock %}
141
146
  {% block header %}
142
147
  {{
143
- onsHeader({
144
- "wide": pageConfig.wide,
145
- "fullWidth": pageConfig.fullWidth,
146
- "language": pageConfig.header.language,
147
- "button": pageConfig.header.signoutButton,
148
- "toggleNavigationButton": pageConfig.header.toggleNavigationButton,
149
- "navigation": pageConfig.header.navigation,
150
- "siteSearchAutosuggest": pageConfig.header.siteSearchAutosuggest,
151
- "browserBanner": pageConfig.header.browserBanner,
152
- "phase": pageConfig.header.phase,
153
- "assetsURL": assetsURL,
154
- "serviceLinks": pageConfig.header.serviceLinks,
155
- "variants": pageConfig.header.variants,
156
- "classes": pageConfig.header.classes,
157
- "mastheadLogo": pageConfig.header.mastheadLogo,
158
- "mastheadLogoUrl": pageConfig.header.mastheadLogoUrl,
159
- "titleUrl": pageConfig.header.titleUrl,
160
- "title": pageConfig.header.title | default(pageConfig.title),
161
- "description": pageConfig.header.description,
162
- "titleAsH1": pageConfig.header.titleAsH1,
163
- "titleLogo": pageConfig.header.titleLogo
164
- })
165
- }}
148
+ onsHeader({
149
+ "wide": pageConfig.wide,
150
+ "fullWidth": pageConfig.fullWidth,
151
+ "language": pageConfig.header.language,
152
+ "button": pageConfig.header.signoutButton,
153
+ "toggleNavigationButton": pageConfig.header.toggleNavigationButton,
154
+ "navigation": pageConfig.header.navigation,
155
+ "siteSearchAutosuggest": pageConfig.header.siteSearchAutosuggest,
156
+ "browserBanner": pageConfig.header.browserBanner,
157
+ "phase": pageConfig.header.phase,
158
+ "assetsURL": assetsURL,
159
+ "serviceLinks": pageConfig.header.serviceLinks,
160
+ "variants": pageConfig.header.variants,
161
+ "classes": pageConfig.header.classes,
162
+ "mastheadLogo": pageConfig.header.mastheadLogo,
163
+ "mastheadLogoUrl": pageConfig.header.mastheadLogoUrl,
164
+ "titleUrl": pageConfig.header.titleUrl,
165
+ "title": pageConfig.header.title | default(pageConfig.title),
166
+ "description": pageConfig.header.description,
167
+ "titleAsH1": pageConfig.header.titleAsH1,
168
+ "titleLogo": pageConfig.header.titleLogo
169
+ })
170
+ }}
166
171
  {% endblock %}
167
172
  {% block pageContent %}
168
173
  <div class="ons-page__container ons-container{{ containerClasses }}">
@@ -170,12 +175,12 @@
170
175
  {% if pageConfig.breadcrumbs %}
171
176
  {% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
172
177
  {{
173
- onsBreadcrumbs({
174
- "id": pageConfig.breadcrumbs.id,
175
- "ariaLabel": pageConfig.breadcrumbs.ariaLabel,
176
- "itemsList": pageConfig.breadcrumbs.itemsList
177
- })
178
- }}
178
+ onsBreadcrumbs({
179
+ "id": pageConfig.breadcrumbs.id,
180
+ "ariaLabel": pageConfig.breadcrumbs.ariaLabel,
181
+ "itemsList": pageConfig.breadcrumbs.itemsList
182
+ })
183
+ }}
179
184
  {% endif %}
180
185
  {% endblock %}
181
186
  <div class="ons-grid">
@@ -243,4 +248,4 @@
243
248
 
244
249
  {% block scripts %}{% endblock %}
245
250
  </body>
246
- </html>
251
+ </html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ons/design-system",
3
3
  "description": "ONS Design System built CSS, JS, and Nunjucks templates",
4
- "version": "65.2.2",
4
+ "version": "65.2.3",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -97,9 +97,10 @@
97
97
  "gulp-terser": "^2.0.1",
98
98
  "http-server": "^0.12.3",
99
99
  "husky": "^8.0.3",
100
- "jest": "^27.5.1",
101
- "jest-axe": "^6.0.0",
102
- "jest-puppeteer": "^6.1.0",
100
+ "jest": "^29.6.1",
101
+ "jest-axe": "^8.0.0",
102
+ "jest-environment-jsdom": "^29.6.1",
103
+ "jest-puppeteer": "^9.0.0",
103
104
  "js-beautify": "^1.11.0",
104
105
  "lighthouse": "^10.4.0",
105
106
  "lint-staged": "^8.1.0",
@@ -113,7 +114,7 @@
113
114
  "postcss-url": "^8.0.0",
114
115
  "prepend-file": "^1.3.1",
115
116
  "prettier": "^3.0.0",
116
- "puppeteer": "^13.5.1",
117
+ "puppeteer": "^21.0.2",
117
118
  "remark-cli": "^11.0.0",
118
119
  "remark-lint": "^9.1.2",
119
120
  "remark-preset-lint-recommended": "^6.1.3",