title: How to write test for directives
body: <p>I tried to write test case for directive, But i can't write. So, guys can u share the correct test case with explanation for given directive.js.</p>
  
  <pre><code>myapp.directive('number', function() {
      return {
          restrict: 'A',
          link: function(scope, element, attr, form) {    
              element.bind('input', function(e) {
                  $(this).val($(this).val().replace(/[^0-9 ]/gi, ''));
              });
          }
      }
  });
  </code></pre>
  
  <p>This directive should return numbers only.</p>