A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.rubydoc.info/github/teamcapybara/capybara/Capybara/Queries/StyleQuery below:

StyleQuery – Documentation for teamcapybara/capybara (master) – RubyDoc.info

Class: Capybara::Queries::StyleQuery Private

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

BaseQuery::COUNT_KEYS

Instance Attribute Summary Attributes inherited from BaseQuery

#options, #session_options

Instance Method Summary collapse 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:, **options)
  @expected_styles = stringify_keys(expected_styles)
  @options = options
  @actual_styles = {}
  super(@options)
  self.session_options = session_options

  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 failure_message
  +"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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4