Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeuš Varnas committed Sep 28, 2017
1 parent 7a44d7d commit 480f658
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib/src/ng-select.component.spec.ts
Expand Up @@ -60,6 +60,20 @@ describe('NgSelectComponent', function () {
expect(fixture.componentInstance.select.value).toEqual(null);
discardPeriodicTasks();
}));

it('should clear previous value when setting new model', fakeAsync(() => {
fixture.componentInstance.selectedCity = fixture.componentInstance.cities[0];
fixture.detectChanges();
tick();

const lastSelection: any = fixture.componentInstance.cities[0];
expect(lastSelection.selected).toBeTruthy();

fixture.componentInstance.selectedCity = null;
fixture.detectChanges();
tick();
expect(lastSelection.selected).toBeFalsy();
}));
});

describe('Model bindings', () => {
Expand Down

0 comments on commit 480f658

Please sign in to comment.