@ons/design-system 63.0.0 → 64.0.0
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/components/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +1 -1
- package/components/char-check-limit/character-check.spec.js +16 -16
- package/components/checkboxes/_macro.njk +3 -1
- package/components/checkboxes/example-checkboxes-with-descriptions.njk +1 -0
- package/components/cookies-banner/_macro.njk +2 -2
- package/components/cookies-banner/_macro.spec.js +2 -2
- package/components/input/_input.scss +6 -0
- package/components/input/_macro.njk +20 -13
- package/components/input/_macro.spec.js +2 -22
- package/components/{search/example-search-with-character-check.njk → input/example-input-search-with-character-check.njk} +1 -2
- package/components/{search/example-search-with-placeholder.njk → input/example-input-search-with-placeholder.njk} +1 -2
- package/components/{search/example-search.njk → input/example-input-search.njk} +1 -2
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +1 -1
- package/components/select/_macro.njk +1 -2
- package/components/summary/_macro.njk +1 -2
- package/components/summary/_macro.spec.js +7 -22
- package/components/summary/example-summary-grouped-total.njk +0 -2
- package/components/summary/example-summary-grouped-with-errors.njk +0 -4
- package/components/summary/example-summary-grouped.njk +0 -19
- package/components/summary/example-summary-household.njk +0 -5
- package/components/summary/example-summary-hub.njk +0 -8
- package/components/summary/example-summary-multiple.njk +0 -4
- package/components/summary/example-summary.njk +0 -4
- package/components/table/_macro.njk +1 -1
- package/components/table/_macro.spec.js +16 -0
- package/components/table/example-table-numeric.njk +6 -3
- package/components/tabs/_macro.njk +4 -3
- package/components/tabs/_macro.spec.js +23 -0
- package/components/tabs/_tabs.scss +11 -15
- package/components/tabs/example-tabs.njk +6 -6
- package/components/tabs/tabs.js +24 -8
- package/components/tabs/tabs.spec.js +40 -2
- package/components/textarea/_macro.njk +2 -2
- package/components/textarea/_macro.spec.js +2 -2
- package/components/textarea/textarea.spec.js +6 -10
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +0 -1
- package/components/search/_macro.njk +0 -30
- package/components/search/_macro.spec.js +0 -69
- package/components/search/_search.scss +0 -9
|
@@ -9,6 +9,7 @@ const EXAMPLE_TABS = {
|
|
|
9
9
|
{
|
|
10
10
|
id: 'tab.id.1',
|
|
11
11
|
title: 'Tab 1',
|
|
12
|
+
showTitle: true,
|
|
12
13
|
content: 'First content...',
|
|
13
14
|
},
|
|
14
15
|
{
|
|
@@ -24,6 +25,38 @@ const EXAMPLE_TABS = {
|
|
|
24
25
|
],
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
const EXAMPLE_TABS_LONGER = {
|
|
29
|
+
title: 'Example tabs',
|
|
30
|
+
tabs: [
|
|
31
|
+
{
|
|
32
|
+
id: 'tab.id.1',
|
|
33
|
+
title: 'Tab 1',
|
|
34
|
+
showTitle: true,
|
|
35
|
+
content: 'First content...',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'tab.id.2',
|
|
39
|
+
title: 'Tab 2',
|
|
40
|
+
content: 'Second content...',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'tab.id.3',
|
|
44
|
+
title: 'Tab 3',
|
|
45
|
+
content: 'Third content...',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'tab.id.4',
|
|
49
|
+
title: 'Tab 4',
|
|
50
|
+
content: 'Fourth content...',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'tab.id.5',
|
|
54
|
+
title: 'Tab 5',
|
|
55
|
+
content: 'Fifth content...',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
27
60
|
const EXAMPLE_TABS_WITH_NO_INITIAL_ACTIVE_TAB = {
|
|
28
61
|
...EXAMPLE_TABS,
|
|
29
62
|
noInitialActiveTab: true,
|
|
@@ -175,7 +208,7 @@ describe('script: tabs', () => {
|
|
|
175
208
|
beforeEach(async () => {
|
|
176
209
|
await page.emulate(puppeteer.devices['iPhone X']);
|
|
177
210
|
|
|
178
|
-
await setTestPage('/test', renderComponent('tabs',
|
|
211
|
+
await setTestPage('/test', renderComponent('tabs', EXAMPLE_TABS_LONGER));
|
|
179
212
|
});
|
|
180
213
|
|
|
181
214
|
it('has no aria attributes on tabs', async () => {
|
|
@@ -194,11 +227,16 @@ describe('script: tabs', () => {
|
|
|
194
227
|
|
|
195
228
|
it('has no hidden tab panels', async () => {
|
|
196
229
|
const panelCount = await page.$$eval('.ons-tabs__panel', nodes => nodes.length);
|
|
197
|
-
expect(panelCount).toBe(
|
|
230
|
+
expect(panelCount).toBe(5);
|
|
198
231
|
|
|
199
232
|
const hiddenPanelCount = await page.$$eval('.ons-tabs__panel--hidden', nodes => nodes.length);
|
|
200
233
|
expect(hiddenPanelCount).toBe(0);
|
|
201
234
|
});
|
|
235
|
+
|
|
236
|
+
it('displays a h2 element with a unique id', async () => {
|
|
237
|
+
const panelCount = await page.$$eval('#tab-1-content-title', nodes => nodes.length);
|
|
238
|
+
expect(panelCount).toBe(1);
|
|
239
|
+
});
|
|
202
240
|
});
|
|
203
241
|
|
|
204
242
|
describe('when `data-no-initial-active-tab` is present', () => {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
rows="{{ params.rows | default(8) }}"
|
|
27
27
|
{% if params.charCheckLimit and params.charCheckLimit.limit %}
|
|
28
28
|
maxlength="{{ params.charCheckLimit.limit }}"
|
|
29
|
-
data-char-limit-ref="{{ params.id }}-lim
|
|
30
|
-
aria-describedby="{{ params.id }}-lim
|
|
29
|
+
data-char-limit-ref="{{ params.id }}-lim"
|
|
30
|
+
aria-describedby="{{ params.id }}-lim"
|
|
31
31
|
{% endif %}
|
|
32
32
|
{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
33
33
|
>{{ params.value if params.value }}</textarea>
|
|
@@ -216,13 +216,13 @@ describe('macro: textarea', () => {
|
|
|
216
216
|
it('has data attribute which references the character limit component', () => {
|
|
217
217
|
const $ = cheerio.load(renderComponent('textarea', EXAMPLE_TEXTAREA_WITH_CHARACTER_LIMIT));
|
|
218
218
|
|
|
219
|
-
expect($('.ons-input--textarea').attr('data-char-limit-ref')).toBe('example-id-lim
|
|
219
|
+
expect($('.ons-input--textarea').attr('data-char-limit-ref')).toBe('example-id-lim');
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
it('has `aria-describedby` attribute which references the character limit component', () => {
|
|
223
223
|
const $ = cheerio.load(renderComponent('textarea', EXAMPLE_TEXTAREA_WITH_CHARACTER_LIMIT));
|
|
224
224
|
|
|
225
|
-
expect($('.ons-input--textarea').attr('aria-describedby')).toBe('example-id-lim
|
|
225
|
+
expect($('.ons-input--textarea').attr('aria-describedby')).toBe('example-id-lim');
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
it('renders character limit component', () => {
|
|
@@ -24,7 +24,7 @@ describe('script: textarea', () => {
|
|
|
24
24
|
|
|
25
25
|
describe('Given that the char limit helper has initialised correctly', () => {
|
|
26
26
|
it('the char limit readout should be visible', async () => {
|
|
27
|
-
const hasClass = await page.$eval('#example-textarea-lim
|
|
27
|
+
const hasClass = await page.$eval('#example-textarea-lim', node => node.classList.contains('ons-u-d-no'));
|
|
28
28
|
expect(hasClass).toBe(false);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -36,7 +36,7 @@ describe('script: textarea', () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
39
|
-
const readout = await page.$eval('#example-textarea-lim
|
|
39
|
+
const readout = await page.$eval('#example-textarea-lim', node => node.textContent);
|
|
40
40
|
expect(readout).toBe('You have 12 characters remaining');
|
|
41
41
|
});
|
|
42
42
|
});
|
|
@@ -47,7 +47,7 @@ describe('script: textarea', () => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
50
|
-
const readout = await page.$eval('#example-textarea-lim
|
|
50
|
+
const readout = await page.$eval('#example-textarea-lim', node => node.textContent);
|
|
51
51
|
expect(readout).toBe('You have 0 characters remaining');
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -57,9 +57,7 @@ describe('script: textarea', () => {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('then the readout should be given limit reached classes', async () => {
|
|
60
|
-
const hasClass = await page.$eval('#example-textarea-lim
|
|
61
|
-
node.classList.contains('ons-input__limit--reached'),
|
|
62
|
-
);
|
|
60
|
+
const hasClass = await page.$eval('#example-textarea-lim', node => node.classList.contains('ons-input__limit--reached'));
|
|
63
61
|
expect(hasClass).toBe(true);
|
|
64
62
|
});
|
|
65
63
|
});
|
|
@@ -77,7 +75,7 @@ describe('script: textarea', () => {
|
|
|
77
75
|
});
|
|
78
76
|
|
|
79
77
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
80
|
-
const readout = await page.$eval('#example-textarea-lim
|
|
78
|
+
const readout = await page.$eval('#example-textarea-lim', node => node.textContent);
|
|
81
79
|
expect(readout).toBe('You have 1 character remaining');
|
|
82
80
|
});
|
|
83
81
|
|
|
@@ -87,9 +85,7 @@ describe('script: textarea', () => {
|
|
|
87
85
|
});
|
|
88
86
|
|
|
89
87
|
it('then the readout should not be given limit reached classes', async () => {
|
|
90
|
-
const hasClass = await page.$eval('#example-textarea-lim
|
|
91
|
-
node.classList.contains('ons-input__limit--reached'),
|
|
92
|
-
);
|
|
88
|
+
const hasClass = await page.$eval('#example-textarea-lim', node => node.classList.contains('ons-input__limit--reached'));
|
|
93
89
|
expect(hasClass).toBe(false);
|
|
94
90
|
});
|
|
95
91
|
});
|