Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7699401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:28:09+00:00 2026-05-31T22:28:09+00:00

In order to increase test coverage of my project, I’m starting to build tests

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:28:10+00:00Added an answer on May 31, 2026 at 10:28 pm

    Thanks Derek for your answer, the idea of overwriting jQuery.height did the trick, but not in a spy.

    (function(){
      $.prototype.height = function() {
        var original = $.prototype.height;
    
        if (this[0] === window) {
          return 800; // Return mock window height
        } else {
          return original.apply(this, arguments);
        }
      } 
    })();
    

    In the pom.xml I include this file directly after jQuery in the .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to promote good programming habits and increase the efficiency of my code
I'm using the below code in order to increase the number of results that
in order to recover data from server I use XMLHttpRequest and my code is
I modified my web.config to add a custom binding in order to increase the
I'd like to increase the time it takes the ajax to return in order
I've started using TransactionScope to help with my unit tests, in order to put
I am trying to migrate existing code that uses XmlSerializer to protobuf-net due to
I am using an Excel spreadsheet in order to auto increase numbers within text.
Which configuration should I change in order to increase the inventory of a product
is there a way to tweak std::stod() in order to increase the number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.