Unit test case for angular directive to manipulate css

73 views Asked by At
angular.module('myApp').directive(errorDirective, function(){
return {

link: function(scope, element, attributes){
      element.bind('change paste keyup', function(){
      var value= $(this).val();
      if(value < 100)
         $('#inputerror').removeClass('dispnone').addClass('dispblock');
      else if(value >100 && value <500)
         $('#inputerror').removeClass('disp').addClass('dblock');
      else
      $('#inputerror').removeClass('dnone').addClass('displayblock');
      });
      }
}
});

in my html file

<input id= 'inputvalue' ng-model="inputvalue" errorDirective/>
<span id= 'inputerror' class="errorNone"><span>Error occurs </span></span>

How to write the unit test case for the given directive ??

0

There are 0 answers