1- import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
1+ import { fakeAsync , ComponentFixture , TestBed } from '@angular/core/testing' ;
22import { Component } from '@angular/core' ;
33import { By } from '@angular/platform-browser' ;
44import { MatDividerModule } from './divider-module' ;
@@ -8,12 +8,10 @@ describe('MatDivider', () => {
88
99 let fixture : ComponentFixture < MatDividerTestComponent > ;
1010
11- beforeEach ( async ( ( ) => {
11+ beforeEach ( fakeAsync ( ( ) => {
1212 TestBed . configureTestingModule ( {
1313 imports : [ MatDividerModule ] ,
14- declarations : [
15- MatDividerTestComponent
16- ] ,
14+ declarations : [ MatDividerTestComponent ] ,
1715 } ) ;
1816
1917 TestBed . compileComponents ( ) ;
@@ -25,17 +23,27 @@ describe('MatDivider', () => {
2523 fixture . detectChanges ( ) ;
2624
2725 const divider = fixture . debugElement . query ( By . css ( 'mat-divider' ) ) ;
28- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider' ) ;
29- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider-vertical' ) ;
26+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider' ) ;
27+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider-vertical' ) ;
28+ } ) ;
29+
30+ it ( 'should apply horizontal class to horizontal divider' , ( ) => {
31+ fixture . componentInstance . vertical = false ;
32+ fixture . detectChanges ( ) ;
33+
34+ const divider = fixture . debugElement . query ( By . css ( 'mat-divider' ) ) ;
35+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider' ) ;
36+ expect ( divider . nativeElement . classList ) . not . toContain ( 'mat-divider-vertical' ) ;
37+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider-horizontal' ) ;
3038 } ) ;
3139
3240 it ( 'should apply inset class to inset divider' , ( ) => {
3341 fixture . componentInstance . inset = true ;
3442 fixture . detectChanges ( ) ;
3543
3644 const divider = fixture . debugElement . query ( By . css ( 'mat-divider' ) ) ;
37- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider' ) ;
38- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider-inset' ) ;
45+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider' ) ;
46+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider-inset' ) ;
3947 } ) ;
4048
4149 it ( 'should apply inset and vertical classes to vertical inset divider' , ( ) => {
@@ -44,9 +52,9 @@ describe('MatDivider', () => {
4452 fixture . detectChanges ( ) ;
4553
4654 const divider = fixture . debugElement . query ( By . css ( 'mat-divider' ) ) ;
47- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider' ) ;
48- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider-inset' ) ;
49- expect ( divider . nativeElement . className ) . toContain ( 'mat-divider-vertical' ) ;
55+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider' ) ;
56+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider-inset' ) ;
57+ expect ( divider . nativeElement . classList ) . toContain ( 'mat-divider-vertical' ) ;
5058 } ) ;
5159
5260 it ( 'should add aria roles properly' , ( ) => {
0 commit comments