Emulating resize events #39

contra opened this Issue Jan 22, 2013 · 2 comments


None yet

3 participants

contra commented Jan 22, 2013

Is it possible to expose an API in the browser for resizing the window? I'm trying to test some media query stuff


Is that even possible in PhantomJS? If so, I need details. If not, why not use some fancy browser JS and resize via your own code. Some links I found.



PhantomJS can do it via page.clipRect , so mocha-phantomjs could expose an API people could call - but then you won't be able to just open the html and run your tests for debugging or just to visualize it. A goal of mocha-phantomjs is that you can still run your tests in a regular browser.

Though the bigger question is what are you trying to do? Unit test your CSS? if you want to test various screen size, resize events, guestures, etc, you should structure your tests so you can mock those scenarios and test them all that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment