@@ -20,14 +20,28 @@ test('it fires "didResize" when the window is resized', function(assert) {
20
20
let evt = new window . Event ( 'resize' ) ;
21
21
22
22
window . dispatchEvent ( evt ) ;
23
- assert . equal ( didResizeCallCount , 1 , 'didResize called 1 time on event firing' ) ;
23
+ assert . equal ( didResizeCallCount , 0 , 'didResize called 0 time on event firing' ) ;
24
24
service . incrementProperty ( '_oldHeight' , - 20 ) ;
25
25
window . dispatchEvent ( evt ) ;
26
- assert . equal ( didResizeCallCount , 2 , 'didResize called another time on event firing again ' ) ;
26
+ assert . equal ( didResizeCallCount , 1 , 'didResize called 1 time on event firing' ) ;
27
27
service . set ( 'heightSensitive' , false ) ;
28
28
service . incrementProperty ( '_oldHeight' , - 20 ) ;
29
29
window . dispatchEvent ( evt ) ;
30
- assert . equal ( didResizeCallCount , 2 , 'didResize shouldn\'t be called again if heightSensitive is false' ) ;
30
+ assert . equal ( didResizeCallCount , 1 , 'didResize shouldn\'t be called again if heightSensitive is false' ) ;
31
+
32
+ } ) ;
33
+
34
+ test ( 'screenHeight is bound to the non debounced resize' , function ( assert ) {
35
+
36
+ let service = this . subject ( {
37
+ widthSensitive : false ,
38
+ heightSensitive : true
39
+ } ) ;
40
+
41
+ let evt = new window . Event ( 'resize' ) ;
42
+
43
+ window . dispatchEvent ( evt ) ;
44
+ assert . equal ( service . get ( 'screenHeight' ) , window . innerHeight ) ;
31
45
32
46
} ) ;
33
47
@@ -55,6 +69,7 @@ test('it fires "debouncedDidResize" when the window is resized', function(asser
55
69
later ( triggerEvent , 10 ) ;
56
70
}
57
71
72
+ service . incrementProperty ( '_oldHeightDebounced' , - 20 ) ;
58
73
assert . equal ( debouncedDidResizeCallCount , 0 , 'debouncedDidResize not called yet' ) ;
59
74
later ( ( ) => {
60
75
assert . equal ( debouncedDidResizeCallCount , 1 , 'debouncedDidResize called 1 time after 500ms' ) ;
0 commit comments