In order to increase test coverage of my project, I’m starting to build tests for existing JS code.
One of the existing modules puts the window height in a variable with jQuery:
var window_height = jQuery(window).height();
Internally jQuery uses the clientHeight property.
Now with either mvn clean install or mvn -o test I’m getting the error:
Cannot read property “clientHeight” from null
I assume this is because the “virtual browser” that Jasmine creates doesn’t have the window property. Is there any way to make this work?
Thanks Derek for your answer, the idea of overwriting jQuery.height did the trick, but not in a spy.
In the pom.xml I include this file directly after jQuery in the .