title: AngularJS ui-router: Test ui-sref
body: <p>I'm trying to test some views, that are using <code>&lt;a ui-sref='someState'&gt;link&lt;/a&gt;</code> to link to other states in my application. In my tests I'm triggering a click on this elements like this:</p>
  
  <pre><code>element.find('a').click()
  </code></pre>
  
  <p>How do I test, if the state is switched to <code>someState</code>? It would be easy, when using <code>$state</code> in my controller like this:</p>
  
  <pre><code>// in my view
  &lt;a ng-click="goTo('someState')"&gt;link&lt;/a&gt;
  
  // in my controller
  $scope.goTo = function(s) {
    $state.go(s)
  };
  
  // in my tests
  spyOn($state, 'go');
  element.find('a').click()
  expect($state.go).toHaveBeenCalled()
  </code></pre>
  
  <p>But when I use <code>ui-sref</code> I don't know what object to spy on. How can I verify, that my application is in the right state?</p>