| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
| |
| import { RemoveButtonComponent } from './remove-button.component'; |
| |
| describe('RemoveButtonComponent', () => { |
| let component: RemoveButtonComponent; |
| let fixture: ComponentFixture<RemoveButtonComponent>; |
| |
| beforeEach(async(() => { |
| TestBed.configureTestingModule({ |
| declarations: [ RemoveButtonComponent ], |
| }) |
| .compileComponents(); |
| })); |
| |
| beforeEach(() => { |
| fixture = TestBed.createComponent(RemoveButtonComponent); |
| component = fixture.componentInstance; |
| fixture.detectChanges(); |
| }); |
| |
| it('should set the bound model to null', async(() => { |
| let emit = false; |
| expect(component).toBeTruthy(); |
| fixture.detectChanges(); |
| component.nullableAttribute = 'INIT TEXT'; |
| component.nullableAttributeChange.subscribe( changedText => emit = ( changedText === null)); |
| |
| component.clear(); |
| |
| fixture.whenStable().then( () => { |
| expect( emit ).toBeTruthy(); |
| |
| }); |
| })); |
| }); |