Skip to content

Commit 3a2d936

Browse files
committed
Add a css selector method.
We'll soon have this make more sense by returning a more presentable version of the selector used to match elements.
1 parent a200be1 commit 3a2d936

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rails/dom/testing/assertions/selector_assertions.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ def assert_select(*args, &block)
172172
end
173173

174174
selector.select.tap do |matches|
175-
assert_size_match!(matches.size, selector.tests, selector.selector, selector.message)
175+
assert_size_match!(matches.size, selector.tests,
176+
selector.css_selector, selector.message)
176177

177178
nest_selection(matches, &block) if block_given? && !matches.empty?
178179
end

lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
require_relative 'substitution_context'
33

44
class HTMLSelector #:nodoc:
5-
attr_reader :selector, :tests, :message
5+
attr_reader :css_selector, :tests, :message
66

77
def initialize(values, previous_selection = nil, &root_fallback)
88
@values = values
99
@root = extract_root(previous_selection, root_fallback)
10-
@selector = extract_selector
10+
@css_selector = @selector = extract_selector
1111
@tests = extract_equality_tests
1212
@message = @values.shift
1313

@@ -23,7 +23,7 @@ def selecting_no_body? #:nodoc:
2323
end
2424

2525
def select
26-
filter @root.css(selector, context)
26+
filter @root.css(@selector, context)
2727
end
2828

2929
private

0 commit comments

Comments
 (0)