@@ -39,55 +39,65 @@ describe('Controller: uiLayoutCtrl', function () {
3939
4040 describe ( 'mouseMoveHandler' , function ( ) {
4141
42- var controller , window ;
42+ var controller , jQueryWindow ;
4343
4444 beforeEach ( function ( ) {
4545
46- window = { } ;
46+ jQueryWindow = { } ;
47+
48+ spyOn ( window , 'requestAnimationFrame' ) ;
4749
4850 controller = $controller ( 'uiLayoutCtrl' , {
4951 $scope : scope ,
5052 $attrs : { } ,
5153 $element : angular . element ( '<div></div>' ) ,
52- $window : window
54+ $window : jQueryWindow
5355 } ) ;
5456 } ) ;
5557
5658 it ( 'should handle standard mouse event without exception' , function ( ) {
5759 var mockMouseEvent = { } ;
58- mockMouseEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
60+ mockMouseEvent [ controller . sizeProperties . mouseProperty ] = 1 ;
5961
6062 controller . mouseMoveHandler ( mockMouseEvent ) ;
63+
64+ expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
6165 } ) ;
6266
6367 it ( 'should handle jQuery mouse event without exception' , function ( ) {
6468 var mockMouseEvent = {
6569 originalEvent : { }
6670 } ;
67- mockMouseEvent . originalEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
71+ mockMouseEvent . originalEvent [ controller . sizeProperties . mouseProperty ] = 1 ;
6872
6973 controller . mouseMoveHandler ( mockMouseEvent ) ;
74+
75+ expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
7076 } ) ;
7177
7278 it ( 'should handle standard touch event without exception' , function ( ) {
7379 var mockMouseEvent = {
7480 targetTouches : [ ]
7581 } ;
7682 mockMouseEvent . targetTouches [ 0 ] = { } ;
77- mockMouseEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
83+ mockMouseEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 1 ;
7884
7985 controller . mouseMoveHandler ( mockMouseEvent ) ;
86+
87+ expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
8088 } ) ;
8189
8290 it ( 'should handle unrecognised standard event without exception' , function ( ) {
8391 var mockMouseEvent = { } ;
8492
8593 controller . mouseMoveHandler ( mockMouseEvent ) ;
94+
95+ expect ( window . requestAnimationFrame ) . not . toHaveBeenCalled ( ) ;
8696 } ) ;
8797
8898 it ( 'should handle jQuery touch event without exception' , function ( ) {
8999
90- window . jQuery = true ;
100+ jQueryWindow . jQuery = true ;
91101
92102 var mockMouseEvent = {
93103 originalEvent : {
@@ -96,20 +106,24 @@ describe('Controller: uiLayoutCtrl', function () {
96106 } ;
97107
98108 mockMouseEvent . originalEvent . targetTouches [ 0 ] = { } ;
99- mockMouseEvent . originalEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
109+ mockMouseEvent . originalEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 1 ;
100110
101111 controller . mouseMoveHandler ( mockMouseEvent ) ;
112+
113+ expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
102114 } ) ;
103115
104116 it ( 'should handle unrecognised jQuery event without exception' , function ( ) {
105117
106- window . jQuery = true ;
118+ jQueryWindow . jQuery = true ;
107119
108120 var mockMouseEvent = {
109121 originalEvent : { }
110122 } ;
111123
112124 controller . mouseMoveHandler ( mockMouseEvent ) ;
125+
126+ expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
113127 } ) ;
114128 } ) ;
115129 } ) ;
0 commit comments