Skip to content

Commit 0ad7df2

Browse files
authored
test: remove select accessible name tests covered by FieldMixin (#13319)
1 parent a34af1e commit 0ad7df2

1 file changed

Lines changed: 0 additions & 225 deletions

File tree

‎packages/select/test/accessibility.test.js‎

Lines changed: 0 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,6 @@ describe('accessibility', () => {
6767
await nextUpdate(select);
6868
expect(valueButton.hasAttribute('aria-live')).to.be.false;
6969
});
70-
71-
it('should set `aria-labelledby` to the label id', () => {
72-
const labelId = select.querySelector('[slot=label]').id;
73-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(labelId);
74-
});
75-
76-
it('should not add the selected item to `aria-labelledby` when an item is selected', async () => {
77-
select.value = 'Option 1';
78-
await nextUpdate(select);
79-
const labelId = select.querySelector('[slot=label]').id;
80-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(labelId);
81-
});
82-
83-
it('should not add the placeholder to `aria-labelledby` when placeholder is set', async () => {
84-
select.placeholder = 'placeholder';
85-
await nextUpdate(select);
86-
const labelId = select.querySelector('[slot=label]').id;
87-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(labelId);
88-
});
8970
});
9071

9172
describe('set before attach', () => {
@@ -124,212 +105,6 @@ describe('accessibility', () => {
124105
});
125106
});
126107

127-
describe('accessible-name', () => {
128-
beforeEach(async () => {
129-
select = fixtureSync('<vaadin-select label="label"></vaadin-select>');
130-
await nextRender();
131-
select.items = [
132-
{ label: 'Option 1', value: 'Option 1' },
133-
{ label: 'Option 2', value: 'Option 2' },
134-
];
135-
await nextUpdate(select);
136-
valueButton = select.querySelector('vaadin-select-value-button');
137-
});
138-
139-
it('should be null by default', () => {
140-
expect(select.accessibleName).to.not.exist;
141-
});
142-
143-
it('should set `aria-label` when the property is set', async () => {
144-
select.accessibleName = 'accessible name';
145-
await nextUpdate(select);
146-
expect(valueButton.getAttribute('aria-label')).to.equal('accessible name');
147-
});
148-
149-
it('should remove `aria-labelledby` when the property is set', async () => {
150-
select.accessibleName = 'accessible name';
151-
await nextUpdate(select);
152-
expect(valueButton.hasAttribute('aria-labelledby')).to.be.false;
153-
});
154-
155-
it('should remove `aria-label` when the property is removed', async () => {
156-
select.accessibleName = 'accessible name';
157-
await nextUpdate(select);
158-
select.accessibleName = null;
159-
await nextUpdate(select);
160-
expect(valueButton.hasAttribute('aria-label')).to.be.false;
161-
});
162-
163-
it('should restore `aria-labelledby` when value is removed', async () => {
164-
const initialLabelledByValue = valueButton.getAttribute('aria-labelledby');
165-
expect(initialLabelledByValue).to.exist;
166-
select.accessibleName = 'accessible name';
167-
await nextUpdate(select);
168-
select.accessibleName = null;
169-
await nextUpdate(select);
170-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(initialLabelledByValue);
171-
});
172-
173-
it('should keep `aria-label` if select value is changed', async () => {
174-
select.accessibleName = 'accessible name';
175-
await nextUpdate(select);
176-
select.value = 'Option 1';
177-
await nextUpdate(select);
178-
expect(valueButton.getAttribute('aria-label')).to.equal('accessible name');
179-
});
180-
181-
it('should not add the placeholder to `aria-labelledby` when placeholder is defined', async () => {
182-
select.accessibleName = 'accessible name';
183-
await nextUpdate(select);
184-
select.placeholder = 'placeholder';
185-
await nextUpdate(select);
186-
expect(valueButton.hasAttribute('aria-labelledby')).to.be.false;
187-
});
188-
189-
it('should not add the selected item to `aria-labelledby` when selected item is set', async () => {
190-
select.accessibleName = 'accessible name';
191-
await nextUpdate(select);
192-
select.value = 'Option 1';
193-
await nextUpdate(select);
194-
expect(valueButton.hasAttribute('aria-labelledby')).to.be.false;
195-
});
196-
197-
describe('accessible-name is set initially', () => {
198-
beforeEach(async () => {
199-
select = fixtureSync('<vaadin-select label="label" accessible-name="accessible name"></vaadin-select>');
200-
await nextRender();
201-
select.items = [
202-
{ label: 'Option 1', value: 'Option 1' },
203-
{ label: 'Option 2', value: 'Option 2' },
204-
];
205-
await nextUpdate(select);
206-
valueButton = select.querySelector('vaadin-select-value-button');
207-
});
208-
209-
it('should have property value in aria-label', () => {
210-
expect(valueButton.getAttribute('aria-label')).to.equal('accessible name');
211-
});
212-
213-
it('should not set aria-labelledby', () => {
214-
expect(valueButton.hasAttribute('aria-labelledby')).to.be.false;
215-
});
216-
217-
it('should use the default label id as the `aria-labelledby` value when accessible-name is removed', async () => {
218-
const label = select.querySelector('[slot=label]');
219-
select.accessibleName = null;
220-
await nextUpdate(select);
221-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(label.id);
222-
});
223-
224-
describe('no items added initially', () => {
225-
beforeEach(async () => {
226-
select = fixtureSync('<vaadin-select label="label" accessible-name="accessible name"></vaadin-select>');
227-
await nextRender();
228-
valueButton = select.querySelector('vaadin-select-value-button');
229-
});
230-
231-
it('should have property value in aria-label', () => {
232-
expect(valueButton.getAttribute('aria-label')).to.equal('accessible name');
233-
});
234-
});
235-
});
236-
});
237-
238-
describe('accessible-name-ref', () => {
239-
beforeEach(async () => {
240-
select = fixtureSync('<vaadin-select label="label"></vaadin-select>');
241-
await nextRender();
242-
select.items = [
243-
{ label: 'Option 1', value: 'Option 1' },
244-
{ label: 'Option 2', value: 'Option 2' },
245-
];
246-
await nextUpdate(select);
247-
valueButton = select.querySelector('vaadin-select-value-button');
248-
});
249-
250-
it('should be null by default', () => {
251-
expect(select.accessibleNameRef).to.not.exist;
252-
});
253-
254-
it('should replace `aria-labelledby` with value given to the property', async () => {
255-
select.accessibleNameRef = 'accessible-name-ref';
256-
await nextUpdate(select);
257-
expect(valueButton.getAttribute('aria-labelledby')).to.equal('accessible-name-ref');
258-
});
259-
260-
it('should restore `aria-labelledby` when value is removed', async () => {
261-
const initialLabelledByValue = valueButton.getAttribute('aria-labelledby');
262-
expect(initialLabelledByValue).to.exist;
263-
select.accessibleNameRef = 'accessible-name-ref';
264-
await nextUpdate(select);
265-
select.accessibleNameRef = null;
266-
await nextUpdate(select);
267-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(initialLabelledByValue);
268-
});
269-
270-
it('should keep `aria-labelledby` if select value is changed', async () => {
271-
select.accessibleNameRef = 'accessible-name-ref';
272-
await nextUpdate(select);
273-
select.value = 'Option 0';
274-
await nextUpdate(select);
275-
expect(valueButton.getAttribute('aria-labelledby')).to.contain('accessible-name-ref');
276-
});
277-
278-
it('should not add the placeholder to `aria-labelledby` when placeholder is defined', async () => {
279-
select.accessibleNameRef = 'accessible-name-ref';
280-
await nextUpdate(select);
281-
select.placeholder = 'placeholder';
282-
await nextUpdate(select);
283-
expect(valueButton.getAttribute('aria-labelledby')).to.equal('accessible-name-ref');
284-
});
285-
286-
it('should not add the selected item to `aria-labelledby` when selected item is set', async () => {
287-
select.accessibleNameRef = 'accessible-name-ref';
288-
await nextUpdate(select);
289-
select.value = 'Option 1';
290-
await nextUpdate(select);
291-
expect(valueButton.getAttribute('aria-labelledby')).to.equal('accessible-name-ref');
292-
});
293-
294-
describe('accessible-name-ref is set initially', () => {
295-
beforeEach(async () => {
296-
select = fixtureSync('<vaadin-select label="label" accessible-name-ref="accessible-name-ref"></vaadin-select>');
297-
await nextRender();
298-
select.items = [
299-
{ label: 'Option 1', value: 'Option 1' },
300-
{ label: 'Option 2', value: 'Option 2' },
301-
];
302-
await nextUpdate(select);
303-
valueButton = select.querySelector('vaadin-select-value-button');
304-
});
305-
306-
it('should have property value in aria-labelledby', () => {
307-
expect(valueButton.getAttribute('aria-labelledby')).to.equal('accessible-name-ref');
308-
});
309-
310-
it('should use the default label id as the `aria-labelledby` value when accessible-name is removed', async () => {
311-
const label = select.querySelector('[slot=label]');
312-
select.accessibleNameRef = null;
313-
await nextUpdate(select);
314-
expect(valueButton.getAttribute('aria-labelledby')).to.equal(label.id);
315-
});
316-
317-
describe('no items added initially', () => {
318-
beforeEach(async () => {
319-
select = fixtureSync(
320-
'<vaadin-select label="label" accessible-name-ref="accessible-name-ref"></vaadin-select>',
321-
);
322-
await nextRender();
323-
valueButton = select.querySelector('vaadin-select-value-button');
324-
});
325-
326-
it('should have property value in aria-labelledby', () => {
327-
expect(valueButton.getAttribute('aria-labelledby')).to.equal('accessible-name-ref');
328-
});
329-
});
330-
});
331-
});
332-
333108
describe('slotted list box', () => {
334109
it('should use the existing slotted list box id for `aria-controls`', async () => {
335110
select = fixtureSync(`

0 commit comments

Comments
 (0)