Unit testing a directive that uses clientHeight
<p>I have a directive that watches the clientHeight of an element with dynamic height and sets a scope variable to that value, but I can't figure out how to unit test it at all. Everything I've done in the unit tests, clientHeight always returns 0. I've tried a number of different solutions I've read for similar problems on here, but none of them work.</p>

<p>Here is the directive:</p>

<pre><code>return {
  link: function (scope, element, attrs) {
    scope.$watch(function () { return element[0].clientHeight; },
      function(newValue, oldValue) {
        if (newValue !== oldValue) {
          scope.$parent.headerHeight = newValue;
        }
      }, true);
  }
};
</code></pre>