Class: Dommy::RSpec::CapyStyleMatchers::HaveRole Private
- Inherits:
-
Object
- Object
- Dommy::RSpec::CapyStyleMatchers::HaveRole
- Defined in:
- lib/dommy/rspec/capy_style_matchers.rb
Overview
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.
Matches elements by computed ARIA role (+ optional accessible name / level), walking the accessibility tree via Interaction::RoleQuery.
Direct Known Subclasses
Instance Method Summary collapse
- #description ⇒ Object private
- #does_not_match?(scope) ⇒ Boolean private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(role, name: nil, level: nil, count: nil, exact: false) ⇒ HaveRole
constructor
private
A new instance of HaveRole.
- #matches?(scope) ⇒ Boolean private
Constructor Details
#initialize(role, name: nil, level: nil, count: nil, exact: false) ⇒ HaveRole
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 HaveRole.
367 368 369 370 371 372 373 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 367 def initialize(role, name: nil, level: nil, count: nil, exact: false) @role = role @name = name @level = level @count = count @exact = exact end |
Instance Method Details
#description ⇒ 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.
388 389 390 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 388 def description "have #{describe_target}" end |
#does_not_match?(scope) ⇒ 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.
383 384 385 386 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 383 def does_not_match?(scope) matches?(scope) @count ? @matched.size != @count : @matched.empty? end |
#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.
392 393 394 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 392 def "expected to find #{describe_target}, found #{@matched.size}" end |
#failure_message_when_negated ⇒ 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.
396 397 398 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 396 def "expected NOT to find #{describe_target}, found #{@matched.size}" end |
#matches?(scope) ⇒ 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.
375 376 377 378 379 380 381 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 375 def matches?(scope) @matched = Interaction::RoleQuery.match( Internal::ScopeResolution.resolve(scope), role: @role, name: @name, level: @level, exact: @exact ) @count ? @matched.size == @count : !@matched.empty? end |