5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
- import { Component , Directive , OnInit , PLATFORM_ID } from '@angular/core' ;
9
- import { CommonModule , isPlatformBrowser } from '@angular/common' ;
8
+ import { Component , Directive , OnInit } from '@angular/core' ;
9
+ import { CommonModule } from '@angular/common' ;
10
10
import { ComponentFixture , TestBed , inject } from '@angular/core/testing' ;
11
11
import {
12
12
ɵMatchMedia as MatchMedia ,
@@ -35,17 +35,15 @@ describe('show directive', () => {
35
35
let fixture : ComponentFixture < any > ;
36
36
let mediaController : MockMatchMedia ;
37
37
let styler : StyleUtils ;
38
- let platformId : Object ;
39
38
let createTestComponent = ( template : string ) => {
40
39
fixture = makeCreateTestComponent ( ( ) => TestShowComponent ) ( template ) ;
41
40
42
41
// Can only Inject() AFTER TestBed.override(...)
43
42
inject (
44
- [ MatchMedia , StyleUtils , PLATFORM_ID ] ,
45
- ( _matchMedia : MockMatchMedia , _styler : StyleUtils , _platformId : Object ) => {
43
+ [ MatchMedia , StyleUtils ] ,
44
+ ( _matchMedia : MockMatchMedia , _styler : StyleUtils ) => {
46
45
mediaController = _matchMedia ;
47
46
styler = _styler ;
48
- platformId = _platformId ;
49
47
} ) ( ) ;
50
48
51
49
return fixture ;
@@ -294,15 +292,9 @@ describe('show directive', () => {
294
292
fixture . detectChanges ( ) ;
295
293
296
294
// NOTE: platform-server can't compute display for unknown elements
297
- if ( isPlatformBrowser ( platformId ) ) {
298
- expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . toHaveCSS ( {
299
- 'display' : 'inline'
300
- } , styler ) ;
301
- } else {
302
- expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . not . toHaveStyle ( {
303
- 'display' : '*'
304
- } , styler ) ;
305
- }
295
+ expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . toHaveCSS ( {
296
+ 'display' : 'initial'
297
+ } , styler ) ;
306
298
307
299
mediaController . activate ( 'xs' ) ;
308
300
fixture . detectChanges ( ) ;
@@ -313,15 +305,9 @@ describe('show directive', () => {
313
305
mediaController . activate ( 'lg' ) ;
314
306
fixture . detectChanges ( ) ;
315
307
// NOTE: platform-server can't compute display for unknown elements
316
- if ( isPlatformBrowser ( platformId ) ) {
317
- expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . toHaveCSS ( {
318
- 'display' : 'inline'
319
- } , styler ) ;
320
- } else {
321
- expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . not . toHaveStyle ( {
322
- 'display' : '*'
323
- } , styler ) ;
324
- }
308
+ expectEl ( queryFor ( fixture , elSelector ) [ 0 ] ) . toHaveCSS ( {
309
+ 'display' : 'initial'
310
+ } , styler ) ;
325
311
} ) ;
326
312
} ) ;
327
313
0 commit comments