1
- import { async , fakeAsync , TestBed , tick } from '@angular/core/testing' ;
1
+ import { async , fakeAsync , TestBed } from '@angular/core/testing' ;
2
2
import { Component } from '@angular/core' ;
3
3
import { By } from '@angular/platform-browser' ;
4
- import { BidiModule , Directionality , DIR_DOCUMENT } from './index' ;
4
+ import { BidiModule , Directionality , Direction , DIR_DOCUMENT } from './index' ;
5
5
6
6
describe ( 'Directionality' , ( ) => {
7
7
let fakeDocument : FakeDocument ;
@@ -62,14 +62,18 @@ describe('Directionality', () => {
62
62
63
63
fixture . detectChanges ( ) ;
64
64
65
+ let direction = injectedDirectionality . value ;
66
+ injectedDirectionality . change . subscribe ( ( dir : Direction ) => { direction = dir ; } ) ;
67
+
68
+ expect ( direction ) . toBe ( 'rtl' ) ;
65
69
expect ( injectedDirectionality . value ) . toBe ( 'rtl' ) ;
66
70
expect ( fixture . componentInstance . changeCount ) . toBe ( 0 ) ;
67
71
68
72
fixture . componentInstance . direction = 'ltr' ;
69
73
70
74
fixture . detectChanges ( ) ;
71
- tick ( ) ;
72
75
76
+ expect ( direction ) . toBe ( 'ltr' ) ;
73
77
expect ( injectedDirectionality . value ) . toBe ( 'ltr' ) ;
74
78
expect ( fixture . componentInstance . changeCount ) . toBe ( 1 ) ;
75
79
} ) ) ;
@@ -79,7 +83,7 @@ describe('Directionality', () => {
79
83
80
84
@Component ( {
81
85
template : `
82
- <div [dir]="direction" (dirChange)="changeCount= changeCount + 1">
86
+ <div [dir]="direction" (dirChange)="changeCount = changeCount + 1">
83
87
<injects-directionality></injects-directionality>
84
88
</div>
85
89
`
0 commit comments