@ons/design-system 50.0.1 → 51.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/README.md +35 -13
- package/components/access-code/_macro.njk +1 -1
- package/components/access-code/_macro.spec.js +162 -0
- package/components/access-code/uac.spec.js +26 -0
- package/components/accordion/_macro.spec.js +224 -0
- package/components/accordion/accordion.spec.js +134 -0
- package/components/address-input/_macro.njk +1 -1
- package/components/address-input/_macro.spec.js +465 -0
- package/components/address-input/autosuggest.address.js +5 -4
- package/components/address-input/autosuggest.address.setter.js +3 -1
- package/components/address-input/autosuggest.address.spec.js +733 -0
- package/components/address-output/_macro.njk +6 -6
- package/components/address-output/_macro.spec.js +122 -0
- package/components/autosuggest/_macro.njk +1 -1
- package/components/autosuggest/_macro.spec.js +229 -0
- package/components/autosuggest/autosuggest.helpers.js +2 -3
- package/components/autosuggest/autosuggest.helpers.spec.js +85 -0
- package/components/autosuggest/autosuggest.js +4 -2
- package/components/autosuggest/autosuggest.spec.js +625 -0
- package/components/autosuggest/autosuggest.ui.js +6 -2
- package/components/breadcrumbs/_macro.spec.js +129 -0
- package/components/button/_macro.njk +5 -5
- package/components/button/_macro.spec.js +446 -0
- package/components/button/button.spec.js +290 -0
- package/components/call-to-action/_macro.njk +3 -1
- package/components/call-to-action/_macro.spec.js +52 -0
- package/components/card/_macro.njk +26 -19
- package/components/card/_macro.spec.js +261 -0
- package/components/char-check-limit/_macro.spec.js +73 -0
- package/components/char-check-limit/character-check.spec.js +196 -0
- package/components/char-check-limit/character-limit.js +1 -1
- package/components/checkboxes/_checkbox-macro.spec.js +419 -0
- package/components/checkboxes/_macro.njk +1 -3
- package/components/checkboxes/_macro.spec.js +306 -0
- package/components/checkboxes/checkboxes.spec.js +208 -0
- package/components/code-highlight/_macro.spec.js +56 -0
- package/components/code-highlight/code-highlight.spec.js +18 -0
- package/components/collapsible/_macro.spec.js +204 -0
- package/components/collapsible/collapsible.js +2 -1
- package/components/collapsible/collapsible.spec.js +236 -0
- package/components/content-pagination/_macro.spec.js +199 -0
- package/components/cookies-banner/_macro.njk +1 -1
- package/components/cookies-banner/_macro.spec.js +171 -0
- package/components/cookies-banner/cookies-banner.spec.js +90 -0
- package/components/date-input/_macro.njk +6 -3
- package/components/date-input/_macro.spec.js +286 -0
- package/components/document-list/_macro.njk +3 -5
- package/components/document-list/_macro.spec.js +491 -0
- package/components/download-resources/download-resources.spec.js +540 -0
- package/components/duration/_macro.njk +7 -6
- package/components/duration/_macro.spec.js +251 -0
- package/components/error/_macro.spec.js +97 -0
- package/components/external-link/_macro.spec.js +60 -0
- package/components/feedback/_macro.njk +5 -3
- package/components/feedback/_macro.spec.js +122 -0
- package/components/field/_macro.njk +2 -2
- package/components/field/_macro.spec.js +97 -0
- package/components/fieldset/_macro.njk +3 -3
- package/components/fieldset/_macro.spec.js +173 -0
- package/components/footer/_macro.njk +11 -48
- package/components/footer/_macro.spec.js +549 -0
- package/components/header/_macro.njk +2 -2
- package/components/header/_macro.spec.js +562 -0
- package/components/hero/_hero.scss +0 -3
- package/components/hero/_macro.njk +4 -4
- package/components/hero/_macro.spec.js +224 -0
- package/components/icons/_macro.njk +15 -15
- package/components/icons/_macro.spec.js +140 -0
- package/components/images/_macro.njk +1 -1
- package/components/images/_macro.spec.js +121 -0
- package/components/input/_input-type.scss +12 -5
- package/components/input/_macro.njk +4 -5
- package/components/input/_macro.spec.js +658 -0
- package/components/label/_macro.spec.js +189 -0
- package/components/language-selector/_macro.spec.js +129 -0
- package/components/lists/_list.scss +4 -0
- package/components/lists/_macro.njk +4 -7
- package/components/lists/_macro.spec.js +618 -0
- package/components/message/_macro.spec.js +137 -0
- package/components/message-list/_macro.njk +7 -7
- package/components/message-list/_macro.spec.js +159 -0
- package/components/metadata/_macro.spec.js +167 -0
- package/components/modal/_macro.njk +6 -6
- package/components/modal/_macro.spec.js +87 -0
- package/components/modal/modal.spec.js +59 -0
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/_macro.spec.js +182 -0
- package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +203 -0
- package/components/mutually-exclusive/mutually-exclusive.date.spec.js +142 -0
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +141 -0
- package/components/mutually-exclusive/mutually-exclusive.email.spec.js +117 -0
- package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +213 -0
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +125 -0
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +131 -0
- package/components/navigation/_macro.njk +6 -6
- package/components/navigation/_macro.spec.js +327 -0
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +232 -0
- package/components/pagination/_macro.njk +1 -1
- package/components/pagination/_macro.spec.js +411 -0
- package/components/panel/_macro.njk +6 -6
- package/components/panel/_macro.spec.js +423 -0
- package/components/password/_macro.spec.js +137 -0
- package/components/password/password.spec.js +40 -0
- package/components/phase-banner/_macro.spec.js +73 -0
- package/components/promotional-banner/_macro.spec.js +97 -0
- package/components/question/_macro.njk +25 -33
- package/components/question/_macro.spec.js +309 -0
- package/components/quote/_macro.spec.js +81 -0
- package/components/radios/_macro.njk +3 -6
- package/components/radios/_macro.spec.js +575 -0
- package/components/radios/radios.spec.js +180 -0
- package/components/related-content/_macro.njk +1 -0
- package/components/related-content/_macro.spec.js +142 -0
- package/components/relationships/_macro.spec.js +108 -0
- package/components/relationships/relationships.spec.js +84 -0
- package/components/reply/_macro.njk +2 -2
- package/components/reply/_macro.spec.js +69 -0
- package/components/reply/reply.spec.js +78 -0
- package/components/search/_macro.njk +14 -12
- package/components/search/_macro.spec.js +44 -0
- package/components/search/_search.scss +7 -7
- package/components/section-navigation/_macro.njk +7 -2
- package/components/section-navigation/_macro.spec.js +206 -0
- package/components/select/_macro.njk +3 -3
- package/components/select/_macro.spec.js +203 -0
- package/components/select/select.spec.js +56 -0
- package/components/share-page/_macro.njk +2 -2
- package/components/share-page/_macro.spec.js +110 -0
- package/components/skip-to-content/_macro.spec.js +57 -0
- package/components/skip-to-content/skip-to-content.spec.js +44 -0
- package/components/status/_macro.spec.js +77 -0
- package/components/summary/_macro.njk +5 -5
- package/components/summary/_macro.spec.js +472 -0
- package/components/table/_macro.njk +2 -2
- package/components/table/_macro.spec.js +557 -0
- package/components/table/table.spec.js +155 -0
- package/components/table-of-contents/_macro.njk +35 -35
- package/components/table-of-contents/_macro.spec.js +178 -0
- package/components/table-of-contents/toc.js +29 -25
- package/components/table-of-contents/toc.spec.js +61 -0
- package/components/tabs/_macro.njk +1 -1
- package/components/tabs/_macro.spec.js +79 -0
- package/components/tabs/tabs.spec.js +162 -0
- package/components/text-indent/_macro.spec.js +52 -0
- package/components/textarea/_macro.njk +5 -3
- package/components/textarea/_macro.spec.js +300 -0
- package/components/textarea/textarea.spec.js +98 -0
- package/components/timeline/_macro.njk +3 -3
- package/components/timeline/_macro.spec.js +81 -0
- package/components/timeout-modal/_macro.spec.js +68 -0
- package/components/timeout-modal/timeout-modal.spec.js +226 -0
- package/components/timeout-panel/_macro.njk +0 -1
- package/components/timeout-panel/_macro.spec.js +54 -0
- package/components/timeout-panel/timeout-panel.dom.js +1 -2
- package/components/timeout-panel/timeout-panel.spec.js +161 -0
- package/components/upload/_macro.spec.js +75 -0
- package/components/video/_macro.spec.js +34 -0
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/js/cookies-settings.spec.js +154 -0
- package/package.json +10 -23
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** @jest-environment jsdom */
|
|
2
|
+
|
|
3
|
+
import * as cheerio from 'cheerio';
|
|
4
|
+
|
|
5
|
+
import axe from '../../tests/helpers/axe';
|
|
6
|
+
import { renderComponent } from '../../tests/helpers/rendering';
|
|
7
|
+
|
|
8
|
+
const EXAMPLE_CHAR_CHECK_LIMIT = {
|
|
9
|
+
id: 'example-char-check-limit',
|
|
10
|
+
charCountSingular: 'You have {x} character remaining',
|
|
11
|
+
charCountPlural: 'You have {x} characters remaining',
|
|
12
|
+
charCountOverLimitSingular: '{x} character too many',
|
|
13
|
+
charCountOverLimitPlural: '{x} characters too many',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
describe('macro: char-check-limit', () => {
|
|
17
|
+
it('passes jest-axe checks without check', async () => {
|
|
18
|
+
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
19
|
+
|
|
20
|
+
const results = await axe($.html());
|
|
21
|
+
expect(results).toHaveNoViolations();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('passes jest-axe checks with check', async () => {
|
|
25
|
+
const $ = cheerio.load(
|
|
26
|
+
renderComponent(
|
|
27
|
+
'char-check-limit',
|
|
28
|
+
{
|
|
29
|
+
...EXAMPLE_CHAR_CHECK_LIMIT,
|
|
30
|
+
type: 'check',
|
|
31
|
+
},
|
|
32
|
+
['<p>Test content.</p>'],
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const results = await axe($.html());
|
|
37
|
+
expect(results).toHaveNoViolations();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('has the provided `id` attribute', () => {
|
|
41
|
+
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
42
|
+
|
|
43
|
+
expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit-remaining');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('has the provided data attributes', () => {
|
|
47
|
+
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
48
|
+
|
|
49
|
+
expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
|
|
50
|
+
expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
|
|
51
|
+
expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many');
|
|
52
|
+
expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('has expected nested content', () => {
|
|
56
|
+
const $ = cheerio.load(
|
|
57
|
+
renderComponent(
|
|
58
|
+
'char-check-limit',
|
|
59
|
+
{
|
|
60
|
+
...EXAMPLE_CHAR_CHECK_LIMIT,
|
|
61
|
+
type: 'check',
|
|
62
|
+
},
|
|
63
|
+
['<p>Test content.</p>'],
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(
|
|
68
|
+
$('.ons-js-char-check-input')
|
|
69
|
+
.html()
|
|
70
|
+
.trim(),
|
|
71
|
+
).toBe('<p>Test content.</p>');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { renderComponent, setTestPage } from '../../tests/helpers/rendering';
|
|
2
|
+
|
|
3
|
+
const EXAMPLE_INPUT_WITH_CHARACTER_CHECK = {
|
|
4
|
+
id: 'search-field',
|
|
5
|
+
type: 'number',
|
|
6
|
+
width: '6',
|
|
7
|
+
label: {
|
|
8
|
+
text: 'Filter results',
|
|
9
|
+
},
|
|
10
|
+
searchButton: {
|
|
11
|
+
text: 'Filter',
|
|
12
|
+
},
|
|
13
|
+
charCheckLimit: {
|
|
14
|
+
charcheckCountdown: true,
|
|
15
|
+
limit: 11,
|
|
16
|
+
charCountOverLimitSingular: '{x} number too many',
|
|
17
|
+
charCountOverLimitPlural: '{x} numbers too many',
|
|
18
|
+
charCountSingular: 'You have {x} character remaining',
|
|
19
|
+
charCountPlural: 'You have {x} characters remaining',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const EXAMPLE_CHARACTER_CHECK_WITH_MUTUALLY_EXCLUSIVE = {
|
|
24
|
+
id: 'feedback',
|
|
25
|
+
name: 'feedback',
|
|
26
|
+
width: '30',
|
|
27
|
+
legend: 'Feeback legend',
|
|
28
|
+
label: {
|
|
29
|
+
text: 'Enter your feedback',
|
|
30
|
+
},
|
|
31
|
+
charCheckLimit: {
|
|
32
|
+
limit: 200,
|
|
33
|
+
charCountSingular: 'You have {x} character remaining',
|
|
34
|
+
charCountPlural: 'You have {x} characters remaining',
|
|
35
|
+
},
|
|
36
|
+
mutuallyExclusive: {
|
|
37
|
+
or: 'Or',
|
|
38
|
+
deselectMessage: 'Selecting this will clear your feedback',
|
|
39
|
+
deselectGroupAdjective: 'cleared',
|
|
40
|
+
deselectExclusiveOptionAdjective: 'deselected',
|
|
41
|
+
exclusiveOptions: [
|
|
42
|
+
{
|
|
43
|
+
id: 'feedback-checkbox',
|
|
44
|
+
name: 'no-feedback',
|
|
45
|
+
value: 'no-feedback',
|
|
46
|
+
label: {
|
|
47
|
+
text: 'I dont want to provide feedback',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe('script: character-check', () => {
|
|
55
|
+
describe('mode: basic', () => {
|
|
56
|
+
beforeEach(async () => {
|
|
57
|
+
await setTestPage('/test', renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_CHECK));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('Given that the char check helper has initialised correctly', () => {
|
|
61
|
+
it('the char check readout should be invisible', async () => {
|
|
62
|
+
const hasClass = await page.$eval('#search-field-check-remaining', element => element.classList.contains('ons-u-d-no'));
|
|
63
|
+
expect(hasClass).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('then the character limit readout should reflect the number of characters remaining', async () => {
|
|
67
|
+
const innerHtml = await page.$eval('#search-field-check-remaining', element => element.innerHTML);
|
|
68
|
+
expect(innerHtml.trim()).toBe('You have 11 characters remaining');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('Given that the user has not typed into the search input', () => {
|
|
73
|
+
describe('when the user types into the search input', () => {
|
|
74
|
+
beforeEach(async () => {
|
|
75
|
+
await page.type('#search-field', '1', { delay: 20 });
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
79
|
+
const innerHtml = await page.$eval('#search-field-check-remaining', element => element.innerHTML);
|
|
80
|
+
expect(innerHtml.trim()).toBe('You have 10 characters remaining');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('the char check readout should be visible', async () => {
|
|
84
|
+
const hasClass = await page.$eval('#search-field-check-remaining', element => element.classList.contains('ons-u-d-no'));
|
|
85
|
+
expect(hasClass).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('then aria-live should be set to polite', async () => {
|
|
89
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check-remaining', element => element.getAttribute('aria-live'));
|
|
90
|
+
expect(ariaLiveAttribute).toBe('polite');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('when the user reaches the charcheck limit of the input', () => {
|
|
95
|
+
beforeEach(async () => {
|
|
96
|
+
await page.type('#search-field', '11111111111', { delay: 20 });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('the char check readout should be invisible', async () => {
|
|
100
|
+
const hasClass = await page.$eval('#search-field-check-remaining', element => element.classList.contains('ons-u-d-no'));
|
|
101
|
+
expect(hasClass).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('when the user has 1 character remaining before the limit is reached', () => {
|
|
106
|
+
beforeEach(async () => {
|
|
107
|
+
await page.type('#search-field', '1111111111', { delay: 20 });
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
111
|
+
const innerHtml = await page.$eval('#search-field-check-remaining', element => element.innerHTML);
|
|
112
|
+
expect(innerHtml.trim()).toBe('You have 1 character remaining');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('Given that the user has exceeded the charcheck limit of the input by 1', () => {
|
|
118
|
+
beforeEach(async () => {
|
|
119
|
+
await page.type('#search-field', '111111111111', { delay: 20 });
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('the char check readout should be visible', async () => {
|
|
123
|
+
const hasClass = await page.$eval('#search-field-check-remaining', element => element.classList.contains('ons-u-d-no'));
|
|
124
|
+
expect(hasClass).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
128
|
+
const innerHtml = await page.$eval('#search-field-check-remaining', element => element.innerHTML);
|
|
129
|
+
expect(innerHtml.trim()).toBe('1 number too many');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('then aria-live should be set to assertive', async () => {
|
|
133
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check-remaining', element => element.getAttribute('aria-live'));
|
|
134
|
+
expect(ariaLiveAttribute).toBe('assertive');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('then the input and readout should be given limit reached classes', async () => {
|
|
138
|
+
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
139
|
+
expect(hasClassOnSearchInput).toBe(true);
|
|
140
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check-remaining', element =>
|
|
141
|
+
element.classList.contains('ons-input__limit--reached'),
|
|
142
|
+
);
|
|
143
|
+
expect(hasClassOnLimitReadout).toBe(true);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('Given that the user has exceeded the charcheck limit of the input by more than 1', () => {
|
|
148
|
+
beforeEach(async () => {
|
|
149
|
+
await page.type('#search-field', '1111111111111', { delay: 20 });
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('the char check readout should be visible', async () => {
|
|
153
|
+
const hasClass = await page.$eval('#search-field-check-remaining', element => element.classList.contains('ons-u-d-no'));
|
|
154
|
+
expect(hasClass).toBe(false);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
158
|
+
const innerHtml = await page.$eval('#search-field-check-remaining', element => element.innerHTML);
|
|
159
|
+
expect(innerHtml.trim()).toBe('2 numbers too many');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('then aria-live should be set to assertive', async () => {
|
|
163
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check-remaining', element => element.getAttribute('aria-live'));
|
|
164
|
+
expect(ariaLiveAttribute).toBe('assertive');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('then the input and readout should be given limit reached classes', async () => {
|
|
168
|
+
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
169
|
+
expect(hasClassOnSearchInput).toBe(true);
|
|
170
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check-remaining', element =>
|
|
171
|
+
element.classList.contains('ons-input__limit--reached'),
|
|
172
|
+
);
|
|
173
|
+
expect(hasClassOnLimitReadout).toBe(true);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('mode: mutually exclusive', () => {
|
|
179
|
+
beforeEach(async () => {
|
|
180
|
+
await setTestPage('/test', renderComponent('textarea', EXAMPLE_CHARACTER_CHECK_WITH_MUTUALLY_EXCLUSIVE));
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('Given that the input value is cleared programatically via mutually exclusive option', () => {
|
|
184
|
+
beforeEach(async () => {
|
|
185
|
+
await page.type('#feedback', '1', { delay: 20 });
|
|
186
|
+
await page.focus('#feedback-checkbox');
|
|
187
|
+
await page.keyboard.press('Space');
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('then aria-live attribute should removed', async () => {
|
|
191
|
+
const hasAriaLiveAttribute = await page.$eval('#feedback-lim-remaining', element => element.hasAttribute('aria-live'));
|
|
192
|
+
expect(hasAriaLiveAttribute).toBe(false);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
});
|
|
@@ -25,6 +25,7 @@ export default class CharLimit {
|
|
|
25
25
|
// Prevent aria live announcement when component initialises
|
|
26
26
|
if (!firstRun && event.inputType) {
|
|
27
27
|
this.limitElement.setAttribute('aria-live', 'polite');
|
|
28
|
+
this.limitElement.setAttribute('aria-live', [remaining > 0 ? 'polite' : 'assertive']);
|
|
28
29
|
} else {
|
|
29
30
|
this.limitElement.removeAttribute('aria-live');
|
|
30
31
|
}
|
|
@@ -39,7 +40,6 @@ export default class CharLimit {
|
|
|
39
40
|
|
|
40
41
|
setLimitClass(remaining, element, limitClass) {
|
|
41
42
|
element.classList[remaining > 0 ? 'remove' : 'add'](limitClass);
|
|
42
|
-
this.limitElement.setAttribute('aria-live', [remaining > 0 ? 'polite' : 'assertive']);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
track(remaining) {
|