I am stuck to test the function that use $j(window).width(). This function return value according to this.Now my problem is this that i want to set window width in my Qunit function.Can any body help ???
I am stuck to test the function that use $j(window).width(). This function return value
Share
In situations when you are expecting a value returned from an object that you don’t control or at least need to test, you should mock the return values. Take a look at JSMockito which is a JavaScript based mocking framework. Below is a simple example that mocks an Array object and sets the value to be returned when the test calls
get(1)method.Hope this helps!