Module: Dommy::Rack
- Defined in:
- lib/dommy/rack.rb,
lib/dommy/rack/url.rb,
lib/dommy/rack/trace.rb,
lib/dommy/rack/errors.rb,
lib/dommy/rack/history.rb,
lib/dommy/rack/locator.rb,
lib/dommy/rack/session.rb,
lib/dommy/rack/version.rb,
lib/dommy/rack/response.rb,
lib/dommy/rack/resources.rb,
lib/dommy/rack/cookie_jar.rb,
lib/dommy/rack/navigation.rb,
lib/dommy/rack/visibility.rb,
lib/dommy/rack/file_upload.rb,
lib/dommy/rack/header_store.rb,
lib/dommy/rack/trace/ndjson.rb,
lib/dommy/rack/http_exchange.rb,
lib/dommy/rack/network_bridge.rb,
lib/dommy/rack/form_submission.rb,
lib/dommy/rack/request_builder.rb,
lib/dommy/rack/session_runtime.rb,
lib/dommy/rack/trace/formatter.rb,
lib/dommy/rack/field_interactor.rb,
lib/dommy/rack/web_socket_frame.rb,
lib/dommy/rack/trace/dom_observer.rb,
lib/dommy/rack/trace/param_filter.rb,
lib/dommy/rack/web_socket_transport.rb,
sig/dommy/rack.rbs
Defined Under Namespace
Modules: FileUpload, NetworkBridge, Url, WebSocketFrame Classes: AmbiguousElementError, CookieJar, CrossOriginError, ElementNotClickableError, ElementNotFoundError, Error, FileNotFoundError, FormSubmission, HeaderStore, History, HttpExchange, InvalidFormError, Locator, Navigation, PageNavigationDelegate, RequestBuilder, Resources, Response, Session, SessionRuntime, TooManyRedirectsError, Trace, UnsupportedContentTypeError, UnsupportedURLError, WebSocketTransport
Constant Summary collapse
- VERSION =
"0.10.0"- FieldInteractor =
The field interactor now lives in dommy core (Dommy::Interaction::FieldInteractor), shared with the standalone Browser (it also fires input/change events now). Aliased here for existing refs.
Dommy::Interaction::FieldInteractor
Class Method Summary collapse
-
.hidden_by_closed_details?(element) ⇒ Boolean
Inside a closed
, everything except theis hidden.
- .hidden_node?(element) ⇒ Boolean
-
.visible?(element) ⇒ Boolean
Visibility check for capybara-style interaction.
Class Method Details
.hidden_by_closed_details?(element) ⇒ Boolean
Inside a closed is hidden.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dommy/rack/visibility.rb', line 33 def hidden_by_closed_details?(element) return false unless element.respond_to?(:closest) return false if element.tag_name == "DETAILS" details = element.closest("details") return false if details.nil? || details.has_attribute?("open") summary = element.closest("summary") !(summary && summary.closest("details")&.equal?(details)) end |
.hidden_node?(element) ⇒ Boolean
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dommy/rack/visibility.rb', line 44 def hidden_node?(element) return true if element.has_attribute?("hidden") return true if element.tag_name == "TEMPLATE" return true if element.tag_name == "INPUT" && element.respond_to?(:type) && element.type == "hidden" style = element.get_attribute("style").to_s.downcase style.match?(/display\s*:\s*none/) || style.match?(/visibility\s*:\s*hidden/) || style.match?(::Dommy::Internal::DomMatching::INLINE_ZERO_OPACITY) end |
.visible?(element) ⇒ Boolean
Visibility check for capybara-style interaction. An element is hidden
if it (or an ancestor) is hidden via the hidden attribute, an inline
display: none / visibility: hidden style, or is an
<input type="hidden">; everything except
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dommy/rack/visibility.rb', line 17 def visible?(element) return false if element.nil? node = element while node.respond_to?(:get_attribute) return false if hidden_node?(node) node = node.respond_to?(:parent_element) ? node.parent_element : nil break if node.nil? end return false if hidden_by_closed_details?(element) ::Dommy::Internal::DomMatching.css_visible?(element) end |