"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/material/chips/chip-remove.spec.ts" between
components-12.0.3.tar.gz and components-12.0.4.tar.gz

About: components offers Component infrastructure and Material Design components for Angular.

chip-remove.spec.ts  (components-12.0.3):chip-remove.spec.ts  (components-12.0.4)
skipping to change at line 34 skipping to change at line 34
fixture = TestBed.createComponent(TestChip); fixture = TestBed.createComponent(TestChip);
testChip = fixture.debugElement.componentInstance; testChip = fixture.debugElement.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
chipDebugElement = fixture.debugElement.query(By.directive(MatChip))!; chipDebugElement = fixture.debugElement.query(By.directive(MatChip))!;
chipNativeElement = chipDebugElement.nativeElement; chipNativeElement = chipDebugElement.nativeElement;
})); }));
describe('basic behavior', () => { describe('basic behavior', () => {
it('should apply a CSS class to the remove icon', () => { it('should apply a CSS class to the remove icon', () => {
let buttonElement = chipNativeElement.querySelector('button')!; const buttonElement = chipNativeElement.querySelector('button')!;
expect(buttonElement.classList).toContain('mat-chip-remove'); expect(buttonElement.classList).toContain('mat-chip-remove');
}); });
it('should ensure that the button cannot submit its parent form', () => { it('should ensure that the button cannot submit its parent form', () => {
const buttonElement = chipNativeElement.querySelector('button')!; const buttonElement = chipNativeElement.querySelector('button')!;
expect(buttonElement.getAttribute('type')).toBe('button'); expect(buttonElement.getAttribute('type')).toBe('button');
}); });
it('should not set the `type` attribute on non-button elements', () => { it('should not set the `type` attribute on non-button elements', () => {
const buttonElement = chipNativeElement.querySelector('span.mat-chip-remov e')!; const buttonElement = chipNativeElement.querySelector('span.mat-chip-remov e')!;
expect(buttonElement.hasAttribute('type')).toBe(false); expect(buttonElement.hasAttribute('type')).toBe(false);
}); });
it('should emit (removed) on click', () => { it('should emit (removed) on click', () => {
let buttonElement = chipNativeElement.querySelector('button')!; const buttonElement = chipNativeElement.querySelector('button')!;
testChip.removable = true; testChip.removable = true;
fixture.detectChanges(); fixture.detectChanges();
spyOn(testChip, 'didRemove'); spyOn(testChip, 'didRemove');
buttonElement.click(); buttonElement.click();
fixture.detectChanges(); fixture.detectChanges();
expect(testChip.didRemove).toHaveBeenCalled(); expect(testChip.didRemove).toHaveBeenCalled();
}); });
it('should not remove if parent chip is disabled', () => { it('should not remove if parent chip is disabled', () => {
let buttonElement = chipNativeElement.querySelector('button')!; const buttonElement = chipNativeElement.querySelector('button')!;
testChip.disabled = true; testChip.disabled = true;
testChip.removable = true; testChip.removable = true;
fixture.detectChanges(); fixture.detectChanges();
spyOn(testChip, 'didRemove'); spyOn(testChip, 'didRemove');
buttonElement.click(); buttonElement.click();
fixture.detectChanges(); fixture.detectChanges();
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

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