@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</span>
|
|
7
7
|
{% endif %}
|
|
8
8
|
<span
|
|
9
|
-
id="{{ params.id }}
|
|
9
|
+
id="{{ params.id }}"
|
|
10
10
|
class="ons-input__limit ons-u-fs-s--b ons-u-d-no ons-u-mt-xs"
|
|
11
11
|
data-charcount-singular="{{ params.charCountSingular }}"
|
|
12
12
|
data-charcount-plural="{{ params.charCountPlural }}"
|
|
@@ -40,7 +40,7 @@ describe('macro: char-check-limit', () => {
|
|
|
40
40
|
it('has the provided `id` attribute', () => {
|
|
41
41
|
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
42
42
|
|
|
43
|
-
expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit
|
|
43
|
+
expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it('has the provided data attributes', () => {
|
|
@@ -59,12 +59,12 @@ describe('script: character-check', () => {
|
|
|
59
59
|
|
|
60
60
|
describe('Given that the char check helper has initialised correctly', () => {
|
|
61
61
|
it('the char check readout should be invisible', async () => {
|
|
62
|
-
const hasClass = await page.$eval('#search-field-check
|
|
62
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
63
63
|
expect(hasClass).toBe(true);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
it('then the character limit readout should reflect the number of characters remaining', async () => {
|
|
67
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
67
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
68
68
|
expect(innerHtml.trim()).toBe('You have 11 characters remaining');
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -76,17 +76,17 @@ describe('script: character-check', () => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
79
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
79
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
80
80
|
expect(innerHtml.trim()).toBe('You have 10 characters remaining');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it('the char check readout should be visible', async () => {
|
|
84
|
-
const hasClass = await page.$eval('#search-field-check
|
|
84
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
85
85
|
expect(hasClass).toBe(false);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
it('then aria-live should be set to polite', async () => {
|
|
89
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
89
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
90
90
|
expect(ariaLiveAttribute).toBe('polite');
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -97,7 +97,7 @@ describe('script: character-check', () => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('the char check readout should be invisible', async () => {
|
|
100
|
-
const hasClass = await page.$eval('#search-field-check
|
|
100
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
101
101
|
expect(hasClass).toBe(true);
|
|
102
102
|
});
|
|
103
103
|
});
|
|
@@ -108,7 +108,7 @@ describe('script: character-check', () => {
|
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
111
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
111
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
112
112
|
expect(innerHtml.trim()).toBe('You have 1 character remaining');
|
|
113
113
|
});
|
|
114
114
|
});
|
|
@@ -120,24 +120,24 @@ describe('script: character-check', () => {
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
it('the char check readout should be visible', async () => {
|
|
123
|
-
const hasClass = await page.$eval('#search-field-check
|
|
123
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
124
124
|
expect(hasClass).toBe(false);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
128
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
128
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
129
129
|
expect(innerHtml.trim()).toBe('1 number too many');
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('then aria-live should be set to assertive', async () => {
|
|
133
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
133
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
134
134
|
expect(ariaLiveAttribute).toBe('assertive');
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
it('then the input and readout should be given limit reached classes', async () => {
|
|
138
138
|
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
139
139
|
expect(hasClassOnSearchInput).toBe(true);
|
|
140
|
-
const hasClassOnLimitReadout = await page.$eval('#search-field-check
|
|
140
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check', element =>
|
|
141
141
|
element.classList.contains('ons-input__limit--reached'),
|
|
142
142
|
);
|
|
143
143
|
expect(hasClassOnLimitReadout).toBe(true);
|
|
@@ -150,24 +150,24 @@ describe('script: character-check', () => {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
it('the char check readout should be visible', async () => {
|
|
153
|
-
const hasClass = await page.$eval('#search-field-check
|
|
153
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
154
154
|
expect(hasClass).toBe(false);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
158
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
158
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
159
159
|
expect(innerHtml.trim()).toBe('2 numbers too many');
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
it('then aria-live should be set to assertive', async () => {
|
|
163
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
163
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
164
164
|
expect(ariaLiveAttribute).toBe('assertive');
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
it('then the input and readout should be given limit reached classes', async () => {
|
|
168
168
|
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
169
169
|
expect(hasClassOnSearchInput).toBe(true);
|
|
170
|
-
const hasClassOnLimitReadout = await page.$eval('#search-field-check
|
|
170
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check', element =>
|
|
171
171
|
element.classList.contains('ons-input__limit--reached'),
|
|
172
172
|
);
|
|
173
173
|
expect(hasClassOnLimitReadout).toBe(true);
|
|
@@ -188,7 +188,7 @@ describe('script: character-check', () => {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
it('then aria-live attribute should removed', async () => {
|
|
191
|
-
const hasAriaLiveAttribute = await page.$eval('#feedback-lim
|
|
191
|
+
const hasAriaLiveAttribute = await page.$eval('#feedback-lim', element => element.hasAttribute('aria-live'));
|
|
192
192
|
expect(hasAriaLiveAttribute).toBe(false);
|
|
193
193
|
});
|
|
194
194
|
});
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
6
6
|
|
|
7
7
|
{% set fields %}
|
|
8
|
+
{% if params.checkboxesLabel is defined %}
|
|
8
9
|
<p class="ons-checkboxes__label{{ " " + params.checkboxesLabelClasses if params.checkboxesLabelClasses }}">{{ params.checkboxesLabel }}</p>
|
|
10
|
+
{% endif %}
|
|
9
11
|
{% set hasOther = false %}
|
|
10
12
|
{% for checkbox in params.checkboxes %}
|
|
11
13
|
{% if checkbox.other %}
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
{% if hasOther == false and params.autoSelect and params.autoSelect.selectAllText %}
|
|
16
18
|
{% set btnClasses = ['small', 'secondary'] %}
|
|
17
19
|
{% if params.borderlessParent == false %}
|
|
18
|
-
{% set btnClasses = ['small', 'secondary', 'ghost-dark'] %}
|
|
20
|
+
{% set btnClasses = ['small', 'secondary', 'ghost', 'ghost-dark'] %}
|
|
19
21
|
{% endif %}
|
|
20
22
|
{{
|
|
21
23
|
onsButton({
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{% set rejectedText = 'You have rejected all additional cookies.' %}
|
|
27
27
|
{% set preferencesText = 'You can <a href="' + settingsLinkURL + '">change your cookie preferences</a> at any time.' %}
|
|
28
28
|
{% set confirmationButtonText = 'Hide' %}
|
|
29
|
-
{% set
|
|
29
|
+
{% set contextSuffix = 'this message' %}
|
|
30
30
|
{% endif %}
|
|
31
31
|
|
|
32
32
|
<div class="ons-cookies-banner" role="region" aria-label="{{ params.ariaLabel | default(ariaLabel)}}">
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
onsButton({
|
|
79
79
|
"type": 'button',
|
|
80
80
|
"text": params.confirmationButtonText | default(confirmationButtonText),
|
|
81
|
-
"buttonContext": params.
|
|
81
|
+
"buttonContext": params.contextSuffix | default(contextSuffix),
|
|
82
82
|
"classes": 'ons-btn--secondary ons-btn--small ons-js-hide-button'
|
|
83
83
|
})
|
|
84
84
|
}}
|
|
@@ -16,7 +16,7 @@ const EXAMPLE_COOKIES_BANNER_PARAMS = {
|
|
|
16
16
|
rejectButtonText: 'Reject additional cookies override',
|
|
17
17
|
preferencesText: 'Text override',
|
|
18
18
|
confirmationButtonText: 'Hide override',
|
|
19
|
-
|
|
19
|
+
contextSuffix: 'the cookie message override',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
describe('macro: cookies-banner', () => {
|
|
@@ -112,7 +112,7 @@ describe('macro: cookies-banner', () => {
|
|
|
112
112
|
expect(buttonSpy.occurrences[2].text).toBe('Hide override');
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
it('has the correct `
|
|
115
|
+
it('has the correct `contextSuffix` for `buttonContext`', () => {
|
|
116
116
|
const faker = templateFaker();
|
|
117
117
|
const buttonSpy = faker.spy('button');
|
|
118
118
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{% macro onsInput(params) %}
|
|
2
2
|
{% from "components/mutually-exclusive/_macro.njk" import onsMutuallyExclusive %}
|
|
3
3
|
{% from "components/char-check-limit/_macro.njk" import onsCharLimit %}
|
|
4
|
-
{% from "components/search/_macro.njk" import onsSearch %}
|
|
5
4
|
{% from "components/field/_macro.njk" import onsField %}
|
|
6
5
|
{% from "components/label/_macro.njk" import onsLabel %}
|
|
6
|
+
{% from "components/button/_macro.njk" import onsButton %}
|
|
7
7
|
|
|
8
8
|
{% if params.type == "number" %}
|
|
9
9
|
{# Type must be "text" or Firefox and Safari will set a blank value to the server if non numeric characters are entered -
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
{% if inputmode %}inputmode="{{ inputmode }}"{% endif %}
|
|
41
41
|
{% if params.autocomplete %}autocomplete="{{ params.autocomplete }}"{% endif %}
|
|
42
42
|
{% if params.accessiblePlaceholder %}placeholder="{{ params.label.text }}"{% endif %}
|
|
43
|
-
{% if params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check
|
|
43
|
+
{% if params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check" data-char-check-num="{{ params.charCheckLimit.limit }}" aria-describedby="{{ params.id }}-check"{% endif %}
|
|
44
44
|
{% if params.charCheckLimit and params.charCheckLimit.charcheckCountdown %}data-char-check-countdown="true"{% endif %}
|
|
45
45
|
{% 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 %}
|
|
46
46
|
{% if params.label and params.label.description %}{% if params.label.id %}aria-describedby="{{ params.label.id }}-description-hint"{% else %}aria-describedby="description-hint"{% endif %}{% endif %}
|
|
@@ -100,21 +100,28 @@
|
|
|
100
100
|
</span>
|
|
101
101
|
{% endif %}
|
|
102
102
|
{% elif params.searchButton %}
|
|
103
|
-
<span class="ons-grid--flex ons-
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
<span class="ons-grid--flex ons-input_search-button">
|
|
104
|
+
{{ input | safe }}
|
|
105
|
+
{%- set buttonLabel -%}
|
|
106
|
+
{%- if params.searchButton.visuallyHideButtonText == true -%}
|
|
107
|
+
<span class="ons-u-vh">{{ params.searchButton.text }}</span>
|
|
108
|
+
{%- else -%}
|
|
109
|
+
{{ params.searchButton.text }}
|
|
110
|
+
{%- endif -%}
|
|
111
|
+
{%- endset -%}
|
|
112
|
+
{{
|
|
113
|
+
onsButton({
|
|
107
114
|
"type": params.searchButton.type,
|
|
115
|
+
"html": buttonLabel,
|
|
108
116
|
"text": params.searchButton.text,
|
|
109
|
-
"visuallyHideButtonText": params.searchButton.visuallyHideButtonText,
|
|
110
117
|
"id": params.searchButton.id,
|
|
118
|
+
"variants": 'small',
|
|
119
|
+
"classes": 'ons-search__btn' + (" " + params.searchButton.classes if params.searchButton.classes else ""),
|
|
111
120
|
"attributes": params.searchButton.attributes,
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
{{ input | safe }}
|
|
117
|
-
{% endcall %}
|
|
121
|
+
"iconType": params.searchButton.iconType,
|
|
122
|
+
"iconPosition": 'only' if params.searchButton.visuallyHideButtonText == true else 'before'
|
|
123
|
+
})
|
|
124
|
+
}}
|
|
118
125
|
</span>
|
|
119
126
|
{% else %}
|
|
120
127
|
{{ input | safe }}
|
|
@@ -535,26 +535,6 @@ describe('macro: input', () => {
|
|
|
535
535
|
});
|
|
536
536
|
|
|
537
537
|
describe('search', () => {
|
|
538
|
-
it('renders `search` component', () => {
|
|
539
|
-
const faker = templateFaker();
|
|
540
|
-
const searchSpy = faker.spy('search');
|
|
541
|
-
|
|
542
|
-
faker.renderComponent('input', EXAMPLE_WITH_SEARCH);
|
|
543
|
-
|
|
544
|
-
expect(searchSpy.occurrences[0]).toEqual({
|
|
545
|
-
accessiblePlaceholder: true,
|
|
546
|
-
searchButton: {
|
|
547
|
-
type: 'button',
|
|
548
|
-
text: 'Search for address',
|
|
549
|
-
id: 'search-for-address',
|
|
550
|
-
attributes: { a: 42 },
|
|
551
|
-
classes: 'extra-search-button-class',
|
|
552
|
-
iconType: 'search',
|
|
553
|
-
visuallyHideButtonText: true,
|
|
554
|
-
},
|
|
555
|
-
});
|
|
556
|
-
});
|
|
557
|
-
|
|
558
538
|
it.each('outputs `type` attribute of "search"', () => {
|
|
559
539
|
const $ = cheerio.load(renderComponent('input', EXAMPLE_WITH_SEARCH));
|
|
560
540
|
|
|
@@ -621,7 +601,7 @@ describe('macro: input', () => {
|
|
|
621
601
|
it('has data attribute which references the character limit component', () => {
|
|
622
602
|
const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_LIMIT));
|
|
623
603
|
|
|
624
|
-
expect($('.ons-input').attr('data-char-check-ref')).toBe('example-id-check
|
|
604
|
+
expect($('.ons-input').attr('data-char-check-ref')).toBe('example-id-check');
|
|
625
605
|
});
|
|
626
606
|
|
|
627
607
|
it('has data attribute which defines limit for character check', () => {
|
|
@@ -633,7 +613,7 @@ describe('macro: input', () => {
|
|
|
633
613
|
it('has `aria-describedby` attribute which references the character limit component', () => {
|
|
634
614
|
const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_LIMIT));
|
|
635
615
|
|
|
636
|
-
expect($('.ons-input').attr('aria-describedby')).toBe('example-id-check
|
|
616
|
+
expect($('.ons-input').attr('aria-describedby')).toBe('example-id-check');
|
|
637
617
|
});
|
|
638
618
|
|
|
639
619
|
it('renders character limit component', () => {
|
|
@@ -63,7 +63,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('then the characters remaining readout should be reset', async () => {
|
|
66
|
-
const limitText = await page.$eval('#feedback-lim
|
|
66
|
+
const limitText = await page.$eval('#feedback-lim', node => node.textContent);
|
|
67
67
|
expect(limitText).toBe('You have 200 characters remaining');
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
id="{{ params.id }}"
|
|
23
23
|
name="{{ params.name }}"
|
|
24
24
|
class="ons-input ons-input--select{% if params.classes %} {{ params.classes }}{% endif %}{% if params.error %} ons-input--error{% endif %}"
|
|
25
|
-
{% if params.value %}value="{{ params.value}}" {% endif %}
|
|
26
25
|
{% 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 %}
|
|
27
26
|
>
|
|
28
27
|
{% for option in params.options %}
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
{% if option.id %}id="{{ option.id }}" {% endif %}
|
|
31
30
|
{% if option.selected %}selected {% endif %}
|
|
32
31
|
{% if option.disabled %}disabled {% endif %}
|
|
33
|
-
{% if
|
|
32
|
+
{% if option.attributes %}{% for attribute, value in option.attributes %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
34
33
|
>
|
|
35
34
|
{{- option.text -}}
|
|
36
35
|
</option>
|
|
@@ -96,9 +96,8 @@
|
|
|
96
96
|
<a
|
|
97
97
|
href="{{ action.url }}"
|
|
98
98
|
class="ons-summary__button"
|
|
99
|
-
{% if action.ariaLabel %} aria-label="{{ action.ariaLabel }}"{% endif %}
|
|
100
99
|
{% if action.attributes %}{% for attribute, value in (action.attributes.items() if action.attributes is mapping and action.attributes.items else action.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
101
|
-
>{{ action.text }}</a>
|
|
100
|
+
>{{ action.text }}<span class="ons-u-vh">answer for {{ row.rowTitle }}</span></a>
|
|
102
101
|
{% endfor %}
|
|
103
102
|
</dd>
|
|
104
103
|
{% endif %}
|
|
@@ -49,7 +49,6 @@ const EXAMPLE_SUMMARY_ROWS = {
|
|
|
49
49
|
actions: [
|
|
50
50
|
{
|
|
51
51
|
text: 'Action 1',
|
|
52
|
-
ariaLabel: 'action aria label 1',
|
|
53
52
|
attributes: {
|
|
54
53
|
a: 'abc',
|
|
55
54
|
b: 'def',
|
|
@@ -58,7 +57,6 @@ const EXAMPLE_SUMMARY_ROWS = {
|
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
59
|
text: 'Action 2',
|
|
61
|
-
ariaLabel: 'action aria label 2',
|
|
62
60
|
url: '#2',
|
|
63
61
|
},
|
|
64
62
|
],
|
|
@@ -149,12 +147,10 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
149
147
|
actions: [
|
|
150
148
|
{
|
|
151
149
|
text: 'Change',
|
|
152
|
-
ariaLabel: 'Change list item',
|
|
153
150
|
url: '#0',
|
|
154
151
|
},
|
|
155
152
|
{
|
|
156
153
|
text: 'Remove',
|
|
157
|
-
ariaLabel: 'Remove list item',
|
|
158
154
|
url: '#0',
|
|
159
155
|
},
|
|
160
156
|
],
|
|
@@ -169,7 +165,6 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
169
165
|
actions: [
|
|
170
166
|
{
|
|
171
167
|
text: 'Change',
|
|
172
|
-
ariaLabel: 'Remove list item',
|
|
173
168
|
url: '#0',
|
|
174
169
|
},
|
|
175
170
|
],
|
|
@@ -184,7 +179,6 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
184
179
|
actions: [
|
|
185
180
|
{
|
|
186
181
|
text: 'Change',
|
|
187
|
-
ariaLabel: 'Change list item',
|
|
188
182
|
url: '#0',
|
|
189
183
|
},
|
|
190
184
|
],
|
|
@@ -203,12 +197,10 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
203
197
|
actions: [
|
|
204
198
|
{
|
|
205
199
|
text: 'Change',
|
|
206
|
-
ariaLabel: 'Change answer',
|
|
207
200
|
url: '#0',
|
|
208
201
|
},
|
|
209
202
|
{
|
|
210
203
|
text: 'Remove',
|
|
211
|
-
ariaLabel: 'Change list item',
|
|
212
204
|
url: '#0',
|
|
213
205
|
},
|
|
214
206
|
],
|
|
@@ -223,7 +215,6 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
223
215
|
actions: [
|
|
224
216
|
{
|
|
225
217
|
text: 'Change',
|
|
226
|
-
ariaLabel: 'Change list item',
|
|
227
218
|
url: '#0',
|
|
228
219
|
},
|
|
229
220
|
],
|
|
@@ -238,7 +229,6 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
238
229
|
actions: [
|
|
239
230
|
{
|
|
240
231
|
text: 'Change',
|
|
241
|
-
ariaLabel: 'Change list item',
|
|
242
232
|
url: '#0',
|
|
243
233
|
},
|
|
244
234
|
],
|
|
@@ -487,25 +477,20 @@ describe('macro: summary', () => {
|
|
|
487
477
|
|
|
488
478
|
expect(
|
|
489
479
|
$('.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__actions .ons-summary__button:first-child').text(),
|
|
490
|
-
).toBe('Action
|
|
480
|
+
).toBe('Action 1answer for row title 2');
|
|
491
481
|
expect(
|
|
492
482
|
$('.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__actions .ons-summary__button:last-child').text(),
|
|
493
|
-
).toBe('Action 2');
|
|
483
|
+
).toBe('Action 2answer for row title 2');
|
|
494
484
|
});
|
|
495
485
|
|
|
496
|
-
it('has the
|
|
486
|
+
it('has the correct visually hidden <span> text', () => {
|
|
497
487
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
498
488
|
|
|
499
489
|
expect(
|
|
500
|
-
$(
|
|
501
|
-
'
|
|
502
|
-
),
|
|
503
|
-
).toBe('
|
|
504
|
-
expect(
|
|
505
|
-
$('.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__actions .ons-summary__button:last-child').attr(
|
|
506
|
-
'aria-label',
|
|
507
|
-
),
|
|
508
|
-
).toBe('action aria label 2');
|
|
490
|
+
$(
|
|
491
|
+
'.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__actions .ons-summary__button:first-child .ons-u-vh',
|
|
492
|
+
).text(),
|
|
493
|
+
).toBe('answer for row title 2');
|
|
509
494
|
});
|
|
510
495
|
|
|
511
496
|
it('has custom `attributes`', () => {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"actions": [
|
|
20
20
|
{
|
|
21
21
|
"text": "Change",
|
|
22
|
-
"ariaLabel": "Change answer",
|
|
23
22
|
"url": "#0"
|
|
24
23
|
}
|
|
25
24
|
]
|
|
@@ -40,7 +39,6 @@
|
|
|
40
39
|
"actions": [
|
|
41
40
|
{
|
|
42
41
|
"text": "Change",
|
|
43
|
-
"ariaLabel": "Change answer",
|
|
44
42
|
"url": "#0"
|
|
45
43
|
}
|
|
46
44
|
]
|
|
@@ -60,7 +58,6 @@
|
|
|
60
58
|
"actions": [
|
|
61
59
|
{
|
|
62
60
|
"text": "Change",
|
|
63
|
-
"ariaLabel": "Change answer",
|
|
64
61
|
"url": "#0"
|
|
65
62
|
}
|
|
66
63
|
]
|
|
@@ -80,7 +77,6 @@
|
|
|
80
77
|
"actions": [
|
|
81
78
|
{
|
|
82
79
|
"text": "Change",
|
|
83
|
-
"ariaLabel": "Change answer",
|
|
84
80
|
"url": "#0"
|
|
85
81
|
}
|
|
86
82
|
]
|