"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/expansion/expansion.spec.ts" between
material2-7.3.3.tar.gz and material2-7.3.4.tar.gz

About: material2 offers Material Design components for Angular.

expansion.spec.ts  (material2-7.3.3):expansion.spec.ts  (material2-7.3.4)
skipping to change at line 120 skipping to change at line 120
it('should set the proper role on the content element', () => { it('should set the proper role on the content element', () => {
const fixture = TestBed.createComponent(PanelWithContent); const fixture = TestBed.createComponent(PanelWithContent);
const contentEl = fixture.nativeElement.querySelector('.mat-expansion-panel- content'); const contentEl = fixture.nativeElement.querySelector('.mat-expansion-panel- content');
expect(contentEl.getAttribute('role')).toBe('region'); expect(contentEl.getAttribute('role')).toBe('region');
}); });
it('should toggle the panel when pressing SPACE on the header', () => { it('should toggle the panel when pressing SPACE on the header', () => {
const fixture = TestBed.createComponent(PanelWithContent); const fixture = TestBed.createComponent(PanelWithContent);
fixture.detectChanges();
const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader'); const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader');
spyOn(fixture.componentInstance.panel, 'toggle'); spyOn(fixture.componentInstance.panel, 'toggle');
const event = dispatchKeyboardEvent(headerEl, 'keydown', SPACE); const event = dispatchKeyboardEvent(headerEl, 'keydown', SPACE);
fixture.detectChanges(); fixture.detectChanges();
expect(fixture.componentInstance.panel.toggle).toHaveBeenCalled(); expect(fixture.componentInstance.panel.toggle).toHaveBeenCalled();
expect(event.defaultPrevented).toBe(true); expect(event.defaultPrevented).toBe(true);
}); });
it('should toggle the panel when pressing ENTER on the header', () => { it('should toggle the panel when pressing ENTER on the header', () => {
const fixture = TestBed.createComponent(PanelWithContent); const fixture = TestBed.createComponent(PanelWithContent);
fixture.detectChanges();
const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader'); const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader');
spyOn(fixture.componentInstance.panel, 'toggle'); spyOn(fixture.componentInstance.panel, 'toggle');
const event = dispatchKeyboardEvent(headerEl, 'keydown', ENTER); const event = dispatchKeyboardEvent(headerEl, 'keydown', ENTER);
fixture.detectChanges(); fixture.detectChanges();
expect(fixture.componentInstance.panel.toggle).toHaveBeenCalled(); expect(fixture.componentInstance.panel.toggle).toHaveBeenCalled();
expect(event.defaultPrevented).toBe(true); expect(event.defaultPrevented).toBe(true);
}); });
it('should not toggle if a modifier key is pressed', () => { it('should not toggle if a modifier key is pressed', () => {
const fixture = TestBed.createComponent(PanelWithContent); const fixture = TestBed.createComponent(PanelWithContent);
fixture.detectChanges();
const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader'); const headerEl = fixture.nativeElement.querySelector('.mat-expansion-panel-h eader');
spyOn(fixture.componentInstance.panel, 'toggle'); spyOn(fixture.componentInstance.panel, 'toggle');
['altKey', 'metaKey', 'shiftKey', 'ctrlKey'].forEach(modifier => { ['altKey', 'metaKey', 'shiftKey', 'ctrlKey'].forEach(modifier => {
const event = createKeyboardEvent('keydown', ENTER); const event = createKeyboardEvent('keydown', ENTER);
Object.defineProperty(event, modifier, {get: () => true}); Object.defineProperty(event, modifier, {get: () => true});
dispatchEvent(headerEl, event); dispatchEvent(headerEl, event);
fixture.detectChanges(); fixture.detectChanges();
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added

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