Module: Dommy::Js::Quickjs::CapybaraDriver
- Defined in:
- lib/dommy/js/quickjs/capybara.rb
Overview
Opt-in Capybara integration. Requiring this file enables JS execution on Capybara::Dommy::Driver (via install_capybara! below), so execute_script / evaluate_script run against the current Dommy document through a QuickJS Runtime. Without this require, capybara-dommy stays JS-free (its default).
The realm-per-document machinery lives in SessionRuntime (shared with Dommy::Rack::Session’s ‘javascript: true`); the driver wires it to the session and the Capybara polling loop, and wraps results as Capybara nodes.
Instance Method Summary collapse
-
#evaluate_async_script(script, *args) ⇒ Object
No real async loop; evaluate synchronously.
- #evaluate_script(script, *_args) ⇒ Object
- #execute_script(script, *_args) ⇒ Object
- #rack_session ⇒ Object
Instance Method Details
#evaluate_async_script(script, *args) ⇒ Object
No real async loop; evaluate synchronously. Sufficient for scripts that resolve immediately (the common Capybara case).
37 38 39 |
# File 'lib/dommy/js/quickjs/capybara.rb', line 37 def evaluate_async_script(script, *args) evaluate_script(script, *args) end |
#evaluate_script(script, *_args) ⇒ Object
31 32 33 |
# File 'lib/dommy/js/quickjs/capybara.rb', line 31 def evaluate_script(script, *_args) (dommy_js_host.evaluate(script)) end |
#execute_script(script, *_args) ⇒ Object
26 27 28 29 |
# File 'lib/dommy/js/quickjs/capybara.rb', line 26 def execute_script(script, *_args) dommy_js_host.execute(script) nil end |
#rack_session ⇒ Object
20 21 22 23 24 |
# File 'lib/dommy/js/quickjs/capybara.rb', line 20 def rack_session session = super dommy_js_attach(session) session end |