From c807ff3380c6e6e29580127056aafc813e9f2989 Mon Sep 17 00:00:00 2001 From: CaerusKaru Date: Mon, 19 Mar 2018 16:19:28 -0400 Subject: [PATCH] test(layout): remove async wrapper to prevent hiding test failure (#10305) * With the async call around the checks in the layout test, the results of the subscribe are never actually checked --- src/cdk/layout/breakpoints-observer.spec.ts | 11 +++++------ src/cdk/layout/layout-module.ts | 17 +++++++++++++++++ src/cdk/layout/public-api.ts | 11 +---------- 3 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 src/cdk/layout/layout-module.ts diff --git a/src/cdk/layout/breakpoints-observer.spec.ts b/src/cdk/layout/breakpoints-observer.spec.ts index e4298638704..20943d96bef 100644 --- a/src/cdk/layout/breakpoints-observer.spec.ts +++ b/src/cdk/layout/breakpoints-observer.spec.ts @@ -5,7 +5,8 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {LayoutModule, BreakpointObserver, BreakpointState} from './index'; +import {LayoutModule} from './layout-module'; +import {BreakpointObserver, BreakpointState} from './breakpoints-observer'; import {MediaMatcher} from './media-matcher'; import {async, TestBed, inject} from '@angular/core/testing'; import {Injectable} from '@angular/core'; @@ -77,11 +78,9 @@ describe('BreakpointObserver', () => { queryMatchState = state.matches; }); - async(() => { - expect(queryMatchState).toBeTruthy(); - mediaMatcher.setMatchesQuery(query, false); - expect(queryMatchState).toBeFalsy(); - }); + expect(queryMatchState).toBeTruthy(); + mediaMatcher.setMatchesQuery(query, false); + expect(queryMatchState).toBeFalsy(); }); it('emits a true matches state when the query is matched', () => { diff --git a/src/cdk/layout/layout-module.ts b/src/cdk/layout/layout-module.ts new file mode 100644 index 00000000000..538ca672f33 --- /dev/null +++ b/src/cdk/layout/layout-module.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import {NgModule} from '@angular/core'; +import {PlatformModule} from '@angular/cdk/platform'; +import {BreakpointObserver} from './breakpoints-observer'; +import {MediaMatcher} from './media-matcher'; + +@NgModule({ + providers: [BreakpointObserver, MediaMatcher], + imports: [PlatformModule], +}) +export class LayoutModule {} diff --git a/src/cdk/layout/public-api.ts b/src/cdk/layout/public-api.ts index a6f7fa6b5b0..e7ea6115f6a 100644 --- a/src/cdk/layout/public-api.ts +++ b/src/cdk/layout/public-api.ts @@ -5,17 +5,8 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {NgModule} from '@angular/core'; -import {PlatformModule} from '@angular/cdk/platform'; -import {BreakpointObserver} from './breakpoints-observer'; -import {MediaMatcher} from './media-matcher'; - -@NgModule({ - providers: [BreakpointObserver, MediaMatcher], - imports: [PlatformModule], -}) -export class LayoutModule {} +export {LayoutModule} from './layout-module'; export {BreakpointObserver, BreakpointState} from './breakpoints-observer'; export {Breakpoints} from './breakpoints'; export {MediaMatcher} from './media-matcher';