Skip to content

Commit 58d2cac

Browse files
committed
fix(material/select): tests
1 parent 848efe1 commit 58d2cac

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

src/material/select/select.spec.ts

+3-28
Original file line numberDiff line numberDiff line change
@@ -183,31 +183,17 @@ describe('MatSelect', () => {
183183
fixture.detectChanges();
184184

185185
const labelId = fixture.nativeElement.querySelector('label').id;
186-
const valueId = fixture.nativeElement.querySelector('.mat-mdc-select-value').id;
187186

188-
expect(select.getAttribute('aria-labelledby')).toBe(`${labelId} ${valueId} myLabelId`);
187+
expect(select.getAttribute('aria-labelledby')).toBe(`${labelId} myLabelId`);
189188
});
190189

191-
it('should set aria-labelledby to the value and label IDs', () => {
190+
it('should set aria-labelledby to the label ID', () => {
192191
fixture.detectChanges();
193192

194193
const labelId = fixture.nativeElement.querySelector('label').id;
195-
const valueId = fixture.nativeElement.querySelector('.mat-mdc-select-value').id;
196-
expect(select.getAttribute('aria-labelledby')).toBe(`${labelId} ${valueId}`);
194+
expect(select.getAttribute('aria-labelledby')).toBe(labelId);
197195
});
198196

199-
it('should trim the trigger aria-labelledby when there is no label', fakeAsync(() => {
200-
fixture.componentInstance.hasLabel = false;
201-
fixture.changeDetectorRef.markForCheck();
202-
fixture.detectChanges();
203-
flush();
204-
fixture.detectChanges();
205-
206-
// Note that we assert that there are no spaces around the value.
207-
const valueId = fixture.nativeElement.querySelector('.mat-mdc-select-value').id;
208-
expect(select.getAttribute('aria-labelledby')).toBe(`${valueId}`);
209-
}));
210-
211197
it('should set the tabindex of the select to 0 by default', () => {
212198
expect(select.getAttribute('tabindex')).toEqual('0');
213199
});
@@ -302,17 +288,6 @@ describe('MatSelect', () => {
302288
expect(select.getAttribute('tabindex')).toEqual('0');
303289
});
304290

305-
it('should set `aria-labelledby` to the value ID if there is no form field', () => {
306-
fixture.destroy();
307-
308-
const labelFixture = TestBed.createComponent(SelectWithChangeEvent);
309-
labelFixture.detectChanges();
310-
select = labelFixture.debugElement.query(By.css('mat-select'))!.nativeElement;
311-
const valueId = labelFixture.nativeElement.querySelector('.mat-mdc-select-value').id;
312-
313-
expect(select.getAttribute('aria-labelledby')?.trim()).toBe(valueId);
314-
});
315-
316291
it('should select options via the UP/DOWN arrow keys on a closed select', fakeAsync(() => {
317292
const formControl = fixture.componentInstance.control;
318293
const options = fixture.componentInstance.options.toArray();

0 commit comments

Comments
 (0)