Skip to content

Commit b9db39f

Browse files
committed
test(select): fix silent error being logged
Fixes a select test that occasionally fails to capture the error inside the expect, causing it to get logged without actually being thrown. This seems to be a Zone-related issue since wrapping a few calls in `async` makes it behave correctly.
1 parent ab77fa9 commit b9db39f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib/select/select.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,13 +1450,13 @@ describe('MdSelect', () => {
14501450
let testInstance: MultiSelect;
14511451
let trigger: HTMLElement;
14521452

1453-
beforeEach(() => {
1453+
beforeEach(async(() => {
14541454
fixture = TestBed.createComponent(MultiSelect);
14551455
testInstance = fixture.componentInstance;
14561456
fixture.detectChanges();
14571457

14581458
trigger = fixture.debugElement.query(By.css('.mat-select-trigger')).nativeElement;
1459-
});
1459+
}));
14601460

14611461
it('should be able to select multiple values', () => {
14621462
trigger.click();
@@ -1616,17 +1616,17 @@ describe('MdSelect', () => {
16161616
expect(trigger.textContent).toContain('Tacos, Pizza, Steak');
16171617
});
16181618

1619-
it('should throw an exception when trying to set a non-array value', () => {
1619+
it('should throw an exception when trying to set a non-array value', async(() => {
16201620
expect(() => {
16211621
testInstance.control.setValue('not-an-array');
16221622
}).toThrowError(wrappedErrorMessage(new MdSelectNonArrayValueError()));
1623-
});
1623+
}));
16241624

1625-
it('should throw an exception when trying to change multiple mode after init', () => {
1625+
it('should throw an exception when trying to change multiple mode after init', async(() => {
16261626
expect(() => {
16271627
testInstance.select.multiple = false;
16281628
}).toThrowError(wrappedErrorMessage(new MdSelectDynamicMultipleError()));
1629-
});
1629+
}));
16301630

16311631
it('should pass the `multiple` value to all of the option instances', async(() => {
16321632
trigger.click();

0 commit comments

Comments
 (0)