"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/select/select.spec.ts" between
material2-7.3.6.tar.gz and material2-7.3.7.tar.gz

About: material2 offers Material Design components for Angular.

select.spec.ts  (material2-7.3.6):select.spec.ts  (material2-7.3.7)
skipping to change at line 850 skipping to change at line 850
multiFixture.detectChanges(); multiFixture.detectChanges();
expect(document.activeElement).toBe(select, 'Expected trigger to be focused.'); expect(document.activeElement).toBe(select, 'Expected trigger to be focused.');
})); }));
}); });
describe('for options', () => { describe('for options', () => {
let fixture: ComponentFixture<BasicSelect>; let fixture: ComponentFixture<BasicSelect>;
let trigger: HTMLElement; let trigger: HTMLElement;
let options: NodeListOf<HTMLElement>; let options: Array<HTMLElement>;
beforeEach(fakeAsync(() => { beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(BasicSelect); fixture = TestBed.createComponent(BasicSelect);
fixture.detectChanges(); fixture.detectChanges();
trigger = fixture.debugElement.query(By.css('.mat-select-trigger')).na tiveElement; trigger = fixture.debugElement.query(By.css('.mat-select-trigger')).na tiveElement;
trigger.click(); trigger.click();
fixture.detectChanges(); fixture.detectChanges();
options = options = Array.from(overlayContainerElement.querySelectorAll('mat-opt
overlayContainerElement.querySelectorAll('mat-option') as NodeList ion'));
Of<HTMLElement>;
})); }));
it('should set the role of mat-option to option', fakeAsync(() => { it('should set the role of mat-option to option', fakeAsync(() => {
expect(options[0].getAttribute('role')).toEqual('option'); expect(options[0].getAttribute('role')).toEqual('option');
expect(options[1].getAttribute('role')).toEqual('option'); expect(options[1].getAttribute('role')).toEqual('option');
expect(options[2].getAttribute('role')).toEqual('option'); expect(options[2].getAttribute('role')).toEqual('option');
})); }));
it('should set aria-selected on each option', fakeAsync(() => { it('should set aria-selected on each option for single select', fakeAsy
expect(options[0].getAttribute('aria-selected')).toEqual('false'); nc(() => {
expect(options[1].getAttribute('aria-selected')).toEqual('false'); expect(options.every(option => !option.hasAttribute('aria-selected')))
expect(options[2].getAttribute('aria-selected')).toEqual('false'); .toBe(true,
'Expected all unselected single-select options not to have aria-sele
cted set.');
options[1].click(); options[1].click();
fixture.detectChanges(); fixture.detectChanges();
trigger.click(); trigger.click();
fixture.detectChanges(); fixture.detectChanges();
flush(); flush();
expect(options[0].getAttribute('aria-selected')).toEqual('false'); expect(options[1].getAttribute('aria-selected')).toEqual('true',
expect(options[1].getAttribute('aria-selected')).toEqual('true'); 'Expected selected single-select option to have aria-selected="true"
expect(options[2].getAttribute('aria-selected')).toEqual('false'); .');
options.splice(1, 1);
expect(options.every(option => !option.hasAttribute('aria-selected')))
.toBe(true,
'Expected all unselected single-select options not to have aria-sele
cted set.');
})); }));
it('should set aria-selected on each option for multi-select', fakeAsync
(() => {
fixture.destroy();
const multiFixture = TestBed.createComponent(MultiSelect);
multiFixture.detectChanges();
trigger = multiFixture.debugElement.query(By.css('.mat-select-trigger'
)).nativeElement;
trigger.click();
multiFixture.detectChanges();
options = Array.from(overlayContainerElement.querySelectorAll('mat-opt
ion'));
expect(options.every(option => option.hasAttribute('aria-selected') &&
option.getAttribute('aria-selected') === 'false')).toBe(true,
'Expected all unselected multi-select options to have aria-selected=
"false".');
options[1].click();
multiFixture.detectChanges();
trigger.click();
multiFixture.detectChanges();
flush();
expect(options[1].getAttribute('aria-selected')).toEqual('true',
'Expected selected multi-select option to have aria-selected="true".
');
options.splice(1, 1);
expect(options.every(option => option.hasAttribute('aria-selected') &&
option.getAttribute('aria-selected') === 'false')).toBe(true,
'Expected all unselected multi-select options to have aria-selected=
"false".');
}));
it('should set the tabindex of each option according to disabled state', fakeAsync(() => { it('should set the tabindex of each option according to disabled state', fakeAsync(() => {
expect(options[0].getAttribute('tabindex')).toEqual('0'); expect(options[0].getAttribute('tabindex')).toEqual('0');
expect(options[1].getAttribute('tabindex')).toEqual('0'); expect(options[1].getAttribute('tabindex')).toEqual('0');
expect(options[2].getAttribute('tabindex')).toEqual('-1'); expect(options[2].getAttribute('tabindex')).toEqual('-1');
})); }));
it('should set aria-disabled for disabled options', fakeAsync(() => { it('should set aria-disabled for disabled options', fakeAsync(() => {
expect(options[0].getAttribute('aria-disabled')).toEqual('false'); expect(options[0].getAttribute('aria-disabled')).toEqual('false');
expect(options[1].getAttribute('aria-disabled')).toEqual('false'); expect(options[1].getAttribute('aria-disabled')).toEqual('false');
expect(options[2].getAttribute('aria-disabled')).toEqual('true'); expect(options[2].getAttribute('aria-disabled')).toEqual('true');
 End of changes. 5 change blocks. 
11 lines changed or deleted 54 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)