title: Angular Testing Directive with templateUrl & isolate scope
body: <p>New at angular.js and can't figure out how to write test for directive with templateUrl &amp; isolate scope.</p>
  
  <p>Here is my controller</p>
  
  <pre><code>(function(){
  angular.module('buttons')
      .controller('buttonController', ['$scope', function($scope){
  
          //primary button
          $scope.primaryButton = { name: 'Submit'};
  })();
  </code></pre>
  
  <p>Here is my views index.html &amp; </p>
  
  <pre><code>&lt;div class="layoutLeft"&gt;
          &lt;p&gt;Primary Button&lt;/p&gt;
          &lt;primary-button info="primaryButton"&gt;&lt;/primary-button&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>primary-button.html</p>
  
  <pre><code>&lt;button class="{{buttonInfo.class}}"&gt;{{buttonInfo.name}}&lt;/button&gt;
  </code></pre>
  
  <p>Here is my directive </p>
  
  <pre><code>(function(){
      angular.module('buttons')
          .directive('primaryButton', function() {
              return {
                  restrict: 'EA',
                  scope: {
                      buttonInfo: '=info'
                  },
                  templateUrl: 'scripts/local/views/primary-button.html'
              }
          })
      })();
  </code></pre>
  
  <p>Here is my test</p>
  
  <pre><code>(function(){
      beforeEach(angular.mock.module('buttons'));
  describe('Buttons Directive Test', function(){
  
      var $compile, $scope, $httpBackend;
  
      beforeEach(module('templates'));
  
      beforeEach(inject(function(_$compile_, _$rootScope_) {
          $compile = _$compile_;
          $scope = _$rootScope_.$new();
  
          $scope.primaryButton = {name: 'Save'};
  
          elm = angular.element("&lt;primary-button info='buttonInfo'&gt;&lt;/primary-button&gt;");
          e = $compile(elm)($scope);
          e.digest();
      }));
  
      it('should do something', function(){
          expect(e.html()).toContain($scope.primaryButton);
      });
  });
  </code></pre>
  
  <p>})();</p>
  
  <p>I am using jasmine and karma for testing, can someone guide some light on what I am doing wrong</p>