mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Merge pull request #928 from teampoltergeist/about_blank
current_url should be about:blank when on about:blank - Fix Issue #927
This commit is contained in:
commit
dd96a31512
3 changed files with 11 additions and 4 deletions
|
@ -392,12 +392,12 @@ Poltergeist.WebPage = (function() {
|
|||
};
|
||||
|
||||
WebPage.prototype.currentUrl = function() {
|
||||
return this["native"]().url;
|
||||
return this["native"]().url || this.runCommand('frameUrl');
|
||||
};
|
||||
|
||||
WebPage.prototype.frameUrl = function() {
|
||||
if (phantom.version.major > 2 || (phantom.version.major === 2 && phantom.version.minor >= 1)) {
|
||||
return this["native"]().frameUrl;
|
||||
return this["native"]().frameUrl || this.runCommand('frameUrl');
|
||||
} else {
|
||||
return this.runCommand('frameUrl');
|
||||
}
|
||||
|
|
|
@ -236,11 +236,13 @@ class Poltergeist.WebPage
|
|||
this.native().frameTitle
|
||||
|
||||
currentUrl: ->
|
||||
@native().url
|
||||
# native url doesn't return anything when about:blank
|
||||
# in that case get the frame url which will be main window
|
||||
@native().url || @runCommand('frameUrl')
|
||||
|
||||
frameUrl: ->
|
||||
if phantom.version.major > 2 || (phantom.version.major == 2 && phantom.version.minor >= 1)
|
||||
@native().frameUrl
|
||||
@native().frameUrl || @runCommand('frameUrl')
|
||||
else
|
||||
@runCommand('frameUrl')
|
||||
|
||||
|
|
|
@ -579,6 +579,11 @@ describe Capybara::Session do
|
|||
@session.visit "/poltergeist/arbitrary_path/200/foo?a=%20%5B%5D%3A%2F%2B%26%3D"
|
||||
expect(request_uri).to eq('/poltergeist/arbitrary_path/200/foo?a=%20%5B%5D%3A%2F%2B%26%3D')
|
||||
end
|
||||
|
||||
it 'returns about:blank when on about:blank' do
|
||||
@session.visit 'about:blank'
|
||||
expect(@session.current_url).to eq('about:blank')
|
||||
end
|
||||
end
|
||||
|
||||
context 'dragging support' do
|
||||
|
|
Loading…
Add table
Reference in a new issue