"Fossies" - the Fresh Open Source Software Archive  

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

About: material2 offers Material Design components for Angular.

slide-toggle.spec.ts  (material2-7.3.5):slide-toggle.spec.ts  (material2-7.3.6)
skipping to change at line 371 skipping to change at line 371
fixture.detectChanges(); fixture.detectChanges();
const slideToggle = fixture.debugElement const slideToggle = fixture.debugElement
.query(By.directive(MatSlideToggle)).componentInstance as MatSlideToggle ; .query(By.directive(MatSlideToggle)).componentInstance as MatSlideToggle ;
expect(slideToggle.tabIndex) expect(slideToggle.tabIndex)
.toBe(5, 'Expected tabIndex property to have been set based on the nativ e attribute'); .toBe(5, 'Expected tabIndex property to have been set based on the nativ e attribute');
})); }));
it('should clear the tabindex from the host element', fakeAsync(() => { it('should set the tabindex of the host element to -1', fakeAsync(() => {
const fixture = TestBed.createComponent(SlideToggleWithTabindexAttr); const fixture = TestBed.createComponent(SlideToggleWithTabindexAttr);
fixture.detectChanges(); fixture.detectChanges();
const slideToggle = fixture.debugElement.query(By.directive(MatSlideToggle )).nativeElement; const slideToggle = fixture.debugElement.query(By.directive(MatSlideToggle )).nativeElement;
expect(slideToggle.getAttribute('tabindex')).toBe('-1'); expect(slideToggle.getAttribute('tabindex')).toBe('-1');
})); }));
it('should remove the tabindex from the host element when disabled', fakeAsy
nc(() => {
const fixture = TestBed.createComponent(SlideToggleWithTabindexAttr);
fixture.componentInstance.disabled = true;
fixture.detectChanges();
const slideToggle = fixture.debugElement.query(By.directive(MatSlideToggle
)).nativeElement;
expect(slideToggle.hasAttribute('tabindex')).toBe(false);
}));
}); });
describe('custom action configuration', () => { describe('custom action configuration', () => {
it('should not change value on click when click action is noop', fakeAsync(( ) => { it('should not change value on click when click action is noop', fakeAsync(( ) => {
TestBed TestBed
.resetTestingModule() .resetTestingModule()
.configureTestingModule({ .configureTestingModule({
imports: [MatSlideToggleModule], imports: [MatSlideToggleModule],
declarations: [SlideToggleBasic], declarations: [SlideToggleBasic],
providers: [ providers: [
skipping to change at line 1122 skipping to change at line 1132
@Component({ @Component({
template: ` template: `
<mat-slide-toggle [formControl]="formControl"> <mat-slide-toggle [formControl]="formControl">
<span>Test Slide Toggle</span> <span>Test Slide Toggle</span>
</mat-slide-toggle>`, </mat-slide-toggle>`,
}) })
class SlideToggleWithFormControl { class SlideToggleWithFormControl {
formControl = new FormControl(); formControl = new FormControl();
} }
@Component({ @Component({template: `<mat-slide-toggle tabindex="5" [disabled]="disabled"></ma
template: `<mat-slide-toggle tabindex="5"></mat-slide-toggle>` t-slide-toggle>`})
}) class SlideToggleWithTabindexAttr {
class SlideToggleWithTabindexAttr {} disabled = false;
}
@Component({ @Component({
template: `<mat-slide-toggle>{{label}}</mat-slide-toggle>` template: `<mat-slide-toggle>{{label}}</mat-slide-toggle>`
}) })
class SlideToggleWithoutLabel { class SlideToggleWithoutLabel {
label: string; label: string;
} }
@Component({ @Component({
template: `<mat-slide-toggle [(ngModel)]="checked" (change)="onChange()"></mat -slide-toggle>` template: `<mat-slide-toggle [(ngModel)]="checked" (change)="onChange()"></mat -slide-toggle>`
 End of changes. 3 change blocks. 
5 lines changed or deleted 18 lines changed or added

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