Class: Capybara::Queries::StyleQuery Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
BaseQuery
|
|
Instance Chain:
self,
BaseQuery
|
|
Inherits: |
Capybara::Queries::BaseQuery
|
Defined in: | lib/capybara/queries/style_query.rb |
Constant Summary
BaseQuery
- Inherited
Class Method Summary
- .new(expected_styles, session_options:, **options) ⇒ StyleQuery constructor Internal use only
BaseQuery
- Inherited
Instance Attribute Summary
BaseQuery
- Inherited
#expects_none? | Checks if a count of 0 is valid for the query Returns false if query does not have any count options specified. |
#options, #session_options, #session_options=, #count_specified? |
Instance Method Summary
- #failure_message Internal use only
- #resolves_for?(node) ⇒ Boolean Internal use only
- #stringify_keys(hsh) private Internal use only
- #valid_keys private Internal use only
BaseQuery
- Inherited
#failure_message | Generates a failure message from the query description and count options. |
#matches_count? | Checks if the given count matches the query count options. |
#negative_failure_message, #wait, #assert_valid_keys, #count_message, #occurrences |
Constructor Details
.new(expected_styles, session_options:, **options) ⇒ StyleQuery
# 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
[ GitHub ]# 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
# 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
#stringify_keys(hsh) (private)
[ GitHub ]# File 'lib/capybara/queries/style_query.rb', line 36
def stringify_keys(hsh) hsh.transform_keys(&:to_s) end
#valid_keys (private)
[ GitHub ]# File 'lib/capybara/queries/style_query.rb', line 40
def valid_keys %i[wait] end