@@ -20,8 +20,8 @@ describe('Directionality', () => {
20
20
it ( 'should read dir from the html element if not specified on the body' , ( ) => {
21
21
fakeDocument . documentElement . dir = 'rtl' ;
22
22
23
- let fixture = TestBed . createComponent ( InjectsDirectionality ) ;
24
- let testComponent = fixture . debugElement . componentInstance ;
23
+ const fixture = TestBed . createComponent ( InjectsDirectionality ) ;
24
+ const testComponent = fixture . debugElement . componentInstance ;
25
25
26
26
expect ( testComponent . dir . value ) . toBe ( 'rtl' ) ;
27
27
} ) ;
@@ -30,23 +30,36 @@ describe('Directionality', () => {
30
30
fakeDocument . documentElement . dir = 'ltr' ;
31
31
fakeDocument . body . dir = 'rtl' ;
32
32
33
- let fixture = TestBed . createComponent ( InjectsDirectionality ) ;
34
- let testComponent = fixture . debugElement . componentInstance ;
33
+ const fixture = TestBed . createComponent ( InjectsDirectionality ) ;
34
+ const testComponent = fixture . debugElement . componentInstance ;
35
35
36
36
expect ( testComponent . dir . value ) . toBe ( 'rtl' ) ;
37
37
} ) ;
38
38
39
39
it ( 'should default to ltr if nothing is specified on either body or the html element' , ( ) => {
40
- let fixture = TestBed . createComponent ( InjectsDirectionality ) ;
41
- let testComponent = fixture . debugElement . componentInstance ;
40
+ const fixture = TestBed . createComponent ( InjectsDirectionality ) ;
41
+ const testComponent = fixture . debugElement . componentInstance ;
42
42
43
43
expect ( testComponent . dir . value ) . toBe ( 'ltr' ) ;
44
44
} ) ;
45
+
46
+ it ( 'should complete the `change` stream on destroy' , ( ) => {
47
+ const fixture = TestBed . createComponent ( InjectsDirectionality ) ;
48
+ const spy = jasmine . createSpy ( 'complete spy' ) ;
49
+ const subscription =
50
+ fixture . componentInstance . dir . change . subscribe ( undefined , undefined , spy ) ;
51
+
52
+ fixture . componentInstance . dir . ngOnDestroy ( ) ;
53
+ expect ( spy ) . toHaveBeenCalled ( ) ;
54
+
55
+ subscription . unsubscribe ( ) ;
56
+ } ) ;
57
+
45
58
} ) ;
46
59
47
60
describe ( 'Dir directive' , ( ) => {
48
61
it ( 'should provide itself as Directionality' , ( ) => {
49
- let fixture = TestBed . createComponent ( ElementWithDir ) ;
62
+ const fixture = TestBed . createComponent ( ElementWithDir ) ;
50
63
const injectedDirectionality =
51
64
fixture . debugElement . query ( By . directive ( InjectsDirectionality ) ) . componentInstance . dir ;
52
65
@@ -56,7 +69,7 @@ describe('Directionality', () => {
56
69
} ) ;
57
70
58
71
it ( 'should emit a change event when the value changes' , fakeAsync ( ( ) => {
59
- let fixture = TestBed . createComponent ( ElementWithDir ) ;
72
+ const fixture = TestBed . createComponent ( ElementWithDir ) ;
60
73
const injectedDirectionality =
61
74
fixture . debugElement . query ( By . directive ( InjectsDirectionality ) ) . componentInstance . dir ;
62
75
0 commit comments