@@ -320,6 +320,49 @@ describe("$animate", function() {
320320 } ) ;
321321 } ) ;
322322
323+ it ( 'should not issue a call to addClass if the provided class value is not a string or array' , function ( ) {
324+ inject ( function ( $animate , $rootScope , $rootElement ) {
325+ var spy = spyOn ( window , 'jqLiteAddClass' ) . andCallThrough ( ) ;
326+
327+ var element = jqLite ( '<div></div>' ) ;
328+ var parent = $rootElement ;
329+
330+ $animate . enter ( element , parent , null , { addClass : noop } ) ;
331+ $rootScope . $digest ( ) ;
332+ expect ( spy ) . not . toHaveBeenCalled ( ) ;
333+
334+ $animate . leave ( element , { addClass : true } ) ;
335+ $rootScope . $digest ( ) ;
336+ expect ( spy ) . not . toHaveBeenCalled ( ) ;
337+
338+ $animate . enter ( element , parent , null , { addClass : 'fatias' } ) ;
339+ $rootScope . $digest ( ) ;
340+ expect ( spy ) . toHaveBeenCalled ( ) ;
341+ } ) ;
342+ } ) ;
343+
344+ it ( 'should not issue a call to removeClass if the provided class value is not a string or array' , function ( ) {
345+ inject ( function ( $animate , $rootScope , $rootElement ) {
346+ var spy = spyOn ( window , 'jqLiteRemoveClass' ) . andCallThrough ( ) ;
347+
348+ var element = jqLite ( '<div></div>' ) ;
349+ var parent = $rootElement ;
350+
351+ $animate . enter ( element , parent , null , { removeClass : noop } ) ;
352+ $rootScope . $digest ( ) ;
353+ expect ( spy ) . not . toHaveBeenCalled ( ) ;
354+
355+ $animate . leave ( element , { removeClass : true } ) ;
356+ $rootScope . $digest ( ) ;
357+ expect ( spy ) . not . toHaveBeenCalled ( ) ;
358+
359+ element . addClass ( 'fatias' ) ;
360+ $animate . enter ( element , parent , null , { removeClass : 'fatias' } ) ;
361+ $rootScope . $digest ( ) ;
362+ expect ( spy ) . toHaveBeenCalled ( ) ;
363+ } ) ;
364+ } ) ;
365+
323366 describe ( 'CSS class DOM manipulation' , function ( ) {
324367 var element ;
325368 var addClass ;
0 commit comments