Class: Dommy::RSpec::Matchers::HaveDomClass Private
- Inherits:
-
Object
- Object
- Dommy::RSpec::Matchers::HaveDomClass
- Defined in:
- lib/dommy/rspec/matchers.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.
Instance Method Summary collapse
- #description ⇒ Object private
- #does_not_match?(element) ⇒ Boolean private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(class_name) ⇒ HaveDomClass
constructor
private
A new instance of HaveDomClass.
- #matches?(element) ⇒ Boolean private
Constructor Details
#initialize(class_name) ⇒ HaveDomClass
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 HaveDomClass.
172 173 174 |
# File 'lib/dommy/rspec/matchers.rb', line 172 def initialize(class_name) @class_name = class_name.to_s 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.
186 187 188 |
# File 'lib/dommy/rspec/matchers.rb', line 186 def description "have DOM class #{@class_name.inspect}" end |
#does_not_match?(element) ⇒ 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.
182 183 184 |
# File 'lib/dommy/rspec/matchers.rb', line 182 def does_not_match?(element) !matches?(element) 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.
190 191 192 |
# File 'lib/dommy/rspec/matchers.rb', line 190 def "expected element to have class #{@class_name.inspect}, got #{@actual_classes.inspect}" 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.
194 195 196 |
# File 'lib/dommy/rspec/matchers.rb', line 194 def "expected element NOT to have class #{@class_name.inspect}, got #{@actual_classes.inspect}" end |
#matches?(element) ⇒ 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.
176 177 178 179 180 |
# File 'lib/dommy/rspec/matchers.rb', line 176 def matches?(element) @element = element @actual_classes = element.class_list.value.to_s.split(/\s+/) @actual_classes.include?(@class_name) end |