@@ -36,5 +36,81 @@ describe('Controller: uiLayoutCtrl', function () {
3636 expect ( uic . isLayoutElement ( tagContainer ) ) . toEqual ( true ) ;
3737 expect ( uic . isLayoutElement ( notUiEl ) ) . toEqual ( false ) ;
3838 } ) ;
39+
40+ describe ( 'mouseMoveHandler' , function ( ) {
41+
42+ var controller , window ;
43+
44+ beforeEach ( function ( ) {
45+
46+ window = { } ;
47+
48+ controller = $controller ( 'uiLayoutCtrl' , {
49+ $scope : scope ,
50+ $attrs : { } ,
51+ $element : angular . element ( '<div></div>' ) ,
52+ $window : window
53+ } ) ;
54+ } ) ;
55+
56+ it ( 'should handle standard mouse event without exception' , function ( ) {
57+ var mockMouseEvent = { } ;
58+ mockMouseEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
59+
60+ controller . mouseMoveHandler ( mockMouseEvent ) ;
61+ } ) ;
62+
63+ it ( 'should handle jQuery mouse event without exception' , function ( ) {
64+ var mockMouseEvent = {
65+ originalEvent : { }
66+ } ;
67+ mockMouseEvent . originalEvent [ controller . sizeProperties . mouseProperty ] = 0 ;
68+
69+ controller . mouseMoveHandler ( mockMouseEvent ) ;
70+ } ) ;
71+
72+ it ( 'should handle standard touch event without exception' , function ( ) {
73+ var mockMouseEvent = {
74+ targetTouches : [ ]
75+ } ;
76+ mockMouseEvent . targetTouches [ 0 ] = { } ;
77+ mockMouseEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
78+
79+ controller . mouseMoveHandler ( mockMouseEvent ) ;
80+ } ) ;
81+
82+ it ( 'should handle unrecognised standard event without exception' , function ( ) {
83+ var mockMouseEvent = { } ;
84+
85+ controller . mouseMoveHandler ( mockMouseEvent ) ;
86+ } ) ;
87+
88+ it ( 'should handle jQuery touch event without exception' , function ( ) {
89+
90+ window . jQuery = true ;
91+
92+ var mockMouseEvent = {
93+ originalEvent : {
94+ targetTouches : [ ]
95+ }
96+ } ;
97+
98+ mockMouseEvent . originalEvent . targetTouches [ 0 ] = { } ;
99+ mockMouseEvent . originalEvent . targetTouches [ 0 ] [ controller . sizeProperties . mouseProperty ] = 0 ;
100+
101+ controller . mouseMoveHandler ( mockMouseEvent ) ;
102+ } ) ;
103+
104+ it ( 'should handle unrecognised jQuery event without exception' , function ( ) {
105+
106+ window . jQuery = true ;
107+
108+ var mockMouseEvent = {
109+ originalEvent : { }
110+ } ;
111+
112+ controller . mouseMoveHandler ( mockMouseEvent ) ;
113+ } ) ;
114+ } ) ;
39115 } ) ;
40116} ) ;
0 commit comments