title: Angular and karma (jasmine) : How can I find an element by class
body: <pre><code>beforeEach(function () {
  
      html = '&lt;div class="dropdown"&gt;'+
                '&lt;div class="trigger" &gt;trigger&lt;/div&gt;'+
                '&lt;div class="dropdown"&gt;body&lt;/div&gt;'+
             '&lt;div&gt;';
  
      inject(function ($compile, $rootScope) {
  
          scope    = $rootScope.$new();
          element  = angular.element(html);
          compiled = $compile(element);
  
          compiled(scope);
          scope.$digest();
  
          // HERE NOT WORKING
          var trigger == element.find('div.trigger');
          var dropdown == element.find('.dropdown');
  
          // trigger and dropdown have both length 0
  
      });
  
      // Test doesn't pass
      it('should find the right element'), function () {
          expect(trigger.hasClass('trigger')).toBe(true);
      }
  
  });
  </code></pre>
  
  <p>I am trying to unit test a directive, but I can't find element by class.</p>
  
  <p>I would like to be able to find element with something like:</p>
  
  <pre><code>var trigger == element.find('div.trigger') // doesn't find anything.
  </code></pre>
  
  <p>but now I am only able to do it like this:</p>
  
  <pre><code>var triggers = element.find('div') // return an array of length 2.
  var trigger = triggers[0];
  </code></pre>
  
  <p>How can I find an element by class?</p>