@@ -37,67 +37,60 @@ describe('Controller: uiLayoutCtrl', function () {
3737 expect ( uic . isLayoutElement ( notUiEl ) ) . toEqual ( false ) ;
3838 } ) ;
3939
40- describe ( 'mouseMoveHandler ' , function ( ) {
40+ describe ( 'getMousePosition ' , function ( ) {
4141
42- var controller , jQueryWindow ;
42+ var controller ;
4343
4444 beforeEach ( function ( ) {
45-
46- jQueryWindow = { } ;
47-
48- spyOn ( window , 'requestAnimationFrame' ) ;
49-
5045 controller = $controller ( 'uiLayoutCtrl' , {
5146 $scope : scope ,
5247 $attrs : { } ,
53- $element : angular . element ( '<div></div>' ) ,
54- $window : jQueryWindow
55- } ) ;
48+ $element : angular . element ( '<div></div>' ) } ) ;
5649 } ) ;
5750
58- it ( 'should handle standard mouse event without exception ' , function ( ) {
51+ it ( 'should handle standard mouse event' , function ( ) {
5952 var mockMouseEvent = { } ;
6053 mockMouseEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
6154
62- controller . mouseMoveHandler ( mockMouseEvent ) ;
55+ var result = controller . getMousePosition ( mockMouseEvent ) ;
6356
64- expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
57+ expect ( result ) . toEqual ( 0 ) ;
6558 } ) ;
6659
67- it ( 'should handle jQuery mouse event without exception' , function ( ) {
60+ it ( 'should handle jQuery mouse event' , function ( ) {
61+
6862 var mockMouseEvent = {
6963 originalEvent : { }
7064 } ;
7165 mockMouseEvent . originalEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
7266
73- controller . mouseMoveHandler ( mockMouseEvent ) ;
74-
75- expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
67+ var result = controller . getMousePosition ( mockMouseEvent ) ;
68+
69+ expect ( result ) . toEqual ( 0 ) ;
7670 } ) ;
7771
78- it ( 'should handle standard touch event without exception' , function ( ) {
72+ it ( 'should handle standard touch event' , function ( ) {
73+
7974 var mockMouseEvent = {
8075 targetTouches : [ ]
8176 } ;
8277 mockMouseEvent . targetTouches [ 0 ] = { } ;
8378 mockMouseEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
8479
85- controller . mouseMoveHandler ( mockMouseEvent ) ;
86-
87- expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
80+ var result = controller . getMousePosition ( mockMouseEvent ) ;
81+
82+ expect ( result ) . toEqual ( 0 ) ;
8883 } ) ;
8984
90- it ( 'should handle unrecognised standard event without exception ' , function ( ) {
85+ it ( 'should handle unrecognised standard event' , function ( ) {
9186 var mockMouseEvent = { } ;
9287
93- controller . mouseMoveHandler ( mockMouseEvent ) ;
88+ var result = controller . getMousePosition ( mockMouseEvent ) ;
9489
95- expect ( window . requestAnimationFrame ) . not . toHaveBeenCalled ( ) ;
90+ expect ( result ) . toEqual ( null ) ;
9691 } ) ;
9792
98- it ( 'should handle jQuery touch event without exception' , function ( ) {
99-
100- jQueryWindow . jQuery = true ;
93+ it ( 'should handle jQuery touch event' , function ( ) {
10194
10295 var mockMouseEvent = {
10396 originalEvent : {
@@ -108,22 +101,20 @@ describe('Controller: uiLayoutCtrl', function () {
108101 mockMouseEvent . originalEvent . targetTouches [ 0 ] = { } ;
109102 mockMouseEvent . originalEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
110103
111- controller . mouseMoveHandler ( mockMouseEvent ) ;
112-
113- expect ( window . requestAnimationFrame ) . toHaveBeenCalled ( ) ;
104+ var result = controller . getMousePosition ( mockMouseEvent ) ;
105+
106+ expect ( result ) . toEqual ( 0 ) ;
114107 } ) ;
115108
116- it ( 'should handle unrecognised jQuery event without exception' , function ( ) {
117-
118- jQueryWindow . jQuery = true ;
119-
109+ it ( 'should handle unrecognised jQuery event' , function ( ) {
110+
120111 var mockMouseEvent = {
121112 originalEvent : { }
122113 } ;
123114
124- controller . mouseMoveHandler ( mockMouseEvent ) ;
125-
126- expect ( window . requestAnimationFrame ) . not . toHaveBeenCalled ( ) ;
115+ var result = controller . getMousePosition ( mockMouseEvent ) ;
116+
117+ expect ( result ) . toEqual ( null ) ;
127118 } ) ;
128119 } ) ;
129120 } ) ;
0 commit comments