mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Default the viewport size to 1024x768
This commit is contained in:
parent
c5a964c9a8
commit
afe5c47079
4 changed files with 13 additions and 2 deletions
|
@ -35,4 +35,4 @@ phantom.injectJs('web_page.js');
|
|||
phantom.injectJs('node.js');
|
||||
phantom.injectJs('connection.js');
|
||||
phantom.injectJs('browser.js');
|
||||
new Poltergeist(phantom.args[0]);
|
||||
new Poltergeist(phantom.args[0]);
|
|
@ -9,6 +9,10 @@ Poltergeist.WebPage = (function() {
|
|||
this["native"] = require('webpage').create();
|
||||
this.nodes = {};
|
||||
this._source = "";
|
||||
this["native"].viewportSize = {
|
||||
width: 1024,
|
||||
height: 768
|
||||
};
|
||||
_ref = WebPage.CALLBACKS;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
callback = _ref[_i];
|
||||
|
|
|
@ -9,6 +9,8 @@ class Poltergeist.WebPage
|
|||
@nodes = {}
|
||||
@_source = ""
|
||||
|
||||
@native.viewportSize = { width: 1024, height: 768 }
|
||||
|
||||
for callback in WebPage.CALLBACKS
|
||||
this.bindCallback(callback)
|
||||
|
||||
|
@ -27,7 +29,7 @@ class Poltergeist.WebPage
|
|||
onInitializedNative: ->
|
||||
@_source = null
|
||||
this.injectAgent()
|
||||
this.setScrollPosition({ left: 0, top: 0})
|
||||
this.setScrollPosition({ left: 0, top: 0 })
|
||||
|
||||
injectAgent: ->
|
||||
if this.evaluate(-> typeof __poltergeist) == "undefined"
|
||||
|
|
|
@ -45,6 +45,11 @@ describe Capybara::Session do
|
|||
@session.should have_content("Hello")
|
||||
other_session.should have_content("Hello")
|
||||
end
|
||||
|
||||
it 'should have a viewport size of 1024x768 by default' do
|
||||
@session.visit('/')
|
||||
@session.evaluate_script('[window.innerWidth, window.innerHeight]').should == [1024, 768]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue