Browse files

Handle window.confirm. Fixes #10.

  • Loading branch information...
1 parent 48c3b97 commit 0ebd617e3c378b1c8fe04f7cad932faaf94d6d98 @jonleighton jonleighton committed Jan 27, 2012
View
3 README.md
@@ -161,6 +161,9 @@ 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]
+
### 0.3.0 ###
* There was a bad bug to do with clicking elements in a page where the
View
2 lib/capybara/poltergeist/client/agent.coffee
@@ -175,3 +175,5 @@ document.addEventListener(
'DOMContentLoaded',
-> console.log('__DOMContentLoaded')
)
+
+window.confirm = (message) -> true
View
5 lib/capybara/poltergeist/client/compiled/agent.js
@@ -202,4 +202,7 @@ PoltergeistAgent.Node = (function() {
window.__poltergeist = new PoltergeistAgent;
document.addEventListener('DOMContentLoaded', function() {
return console.log('__DOMContentLoaded');
-});
+});
+window.confirm = function(message) {
+ return true;
+};
View
5 spec/integration/session_spec.rb
@@ -74,5 +74,10 @@
log.text.should == instruction
end
end
+
+ it 'should handle window.confirm() - returning true unconditionally' do
+ @session.visit '/'
+ @session.evaluate_script("window.confirm('foo')").should == true
+ end
end
end

0 comments on commit 0ebd617

Please sign in to comment.