There is a line in my code:
var contentWidth = angular.element(document.querySelector('.content'))[0].clientWidth;
It works great when starting the application, but when unit testing, I get an error:
TypeError: 'undefined' is not an object (evaluating 'angular.element(document.querySelector('.content'))[0].clientWidth')
How to solve this problem?
source share