1- import { async , fakeAsync , TestBed , tick } from '@angular/core/testing' ;
1+ import { async , fakeAsync , TestBed } from '@angular/core/testing' ;
22import { Component } from '@angular/core' ;
33import { By } from '@angular/platform-browser' ;
4- import { BidiModule , Directionality , DIR_DOCUMENT } from './index' ;
4+ import { BidiModule , Directionality , Direction , DIR_DOCUMENT } from './index' ;
55
66describe ( 'Directionality' , ( ) => {
77 let fakeDocument : FakeDocument ;
@@ -62,14 +62,18 @@ describe('Directionality', () => {
6262
6363 fixture . detectChanges ( ) ;
6464
65+ let direction = injectedDirectionality . value ;
66+ injectedDirectionality . change . subscribe ( ( dir : Direction ) => { direction = dir ; } ) ;
67+
68+ expect ( direction ) . toBe ( 'rtl' ) ;
6569 expect ( injectedDirectionality . value ) . toBe ( 'rtl' ) ;
6670 expect ( fixture . componentInstance . changeCount ) . toBe ( 0 ) ;
6771
6872 fixture . componentInstance . direction = 'ltr' ;
6973
7074 fixture . detectChanges ( ) ;
71- tick ( ) ;
7275
76+ expect ( direction ) . toBe ( 'ltr' ) ;
7377 expect ( injectedDirectionality . value ) . toBe ( 'ltr' ) ;
7478 expect ( fixture . componentInstance . changeCount ) . toBe ( 1 ) ;
7579 } ) ) ;
@@ -79,7 +83,7 @@ describe('Directionality', () => {
7983
8084@Component ( {
8185 template : `
82- <div [dir]="direction" (dirChange)="changeCount= changeCount + 1">
86+ <div [dir]="direction" (dirChange)="changeCount = changeCount + 1">
8387 <injects-directionality></injects-directionality>
8488 </div>
8589 `
0 commit comments