mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Handle window.prompt()
This commit is contained in:
parent
0ebd617e3c
commit
1938eacce4
4 changed files with 16 additions and 3 deletions
|
@ -161,8 +161,11 @@ makes debugging easier). Running `rake autocompile` will watch the
|
|||
`getBoundingClientRect()` method, which will be faster and less
|
||||
buggy.
|
||||
|
||||
* Handle `window.confirm()`. (Always returns true, which is the same
|
||||
as capybara-webkit.) [Issue #10]
|
||||
* Handle `window.confirm()`. Always returns true, which is the same
|
||||
as capybara-webkit. [Issue #10]
|
||||
|
||||
* Handle `window.prompt()`. Returns the default value, if present, or
|
||||
null.
|
||||
|
||||
### 0.3.0 ###
|
||||
|
||||
|
|
|
@ -177,3 +177,4 @@ document.addEventListener(
|
|||
)
|
||||
|
||||
window.confirm = (message) -> true
|
||||
window.prompt = (message, _default) -> _default or null
|
||||
|
|
|
@ -205,4 +205,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
});
|
||||
window.confirm = function(message) {
|
||||
return true;
|
||||
};
|
||||
window.prompt = function(message, _default) {
|
||||
return _default || null;
|
||||
};
|
|
@ -75,9 +75,15 @@ describe Capybara::Session do
|
|||
end
|
||||
end
|
||||
|
||||
it 'should handle window.confirm() - returning true unconditionally' do
|
||||
it 'should handle window.confirm(), returning true unconditionally' do
|
||||
@session.visit '/'
|
||||
@session.evaluate_script("window.confirm('foo')").should == true
|
||||
end
|
||||
|
||||
it 'should handle window.prompt(), returning the default value or null' do
|
||||
@session.visit '/'
|
||||
@session.evaluate_script("window.prompt()").should == nil
|
||||
@session.evaluate_script("window.prompt('foo', 'default')").should == 'default'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue