Class: Capybara::Queries::StyleQuery Private
- Defined in:
- lib/capybara/queries/style_query.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants inherited from BaseQuery
Instance Attribute Summary
Attributes inherited from BaseQuery
Instance Method Summary collapse
- #failure_message ⇒ Object private
-
#initialize(expected_styles, session_options:, **options) ⇒ StyleQuery
constructor
private
A new instance of StyleQuery.
- #resolves_for?(node) ⇒ Boolean private
Methods inherited from BaseQuery
#expects_none?, #matches_count?, #negative_failure_message, wait, #wait
Constructor Details
#initialize(expected_styles, session_options:, **options) ⇒ StyleQuery
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of StyleQuery.
7 8 9 10 11 12 13 14 15 |
# File 'lib/capybara/queries/style_query.rb', line 7 def initialize(expected_styles, session_options:, **) @expected_styles = stringify_keys(expected_styles) @options = @actual_styles = {} super(@options) self. = assert_valid_keys end |
Instance Method Details
#failure_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 |
# File 'lib/capybara/queries/style_query.rb', line 29 def +"Expected node to have styles #{@expected_styles.inspect}. " \ "Actual styles were #{@actual_styles.inspect}" end |
#resolves_for?(node) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/capybara/queries/style_query.rb', line 17 def resolves_for?(node) @node = node @actual_styles = node.style(*@expected_styles.keys) @expected_styles.all? do |style, value| if value.is_a? Regexp value.match? @actual_styles[style] else @actual_styles[style] == value end end end |