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
This commit is contained in:
CaerusKaru
2018-03-19 16:19:28 -04:00
committed by Andrew Seguin
parent 8daa76020d
commit c807ff3380
3 changed files with 23 additions and 16 deletions
+5 -6
View File
@@ -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', () => {
+17
View File
@@ -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 {}
+1 -10
View File
@@ -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';