refine some finders
This commit is contained in:
parent
c9efe01af7
commit
c4387c9f43
|
@ -106,11 +106,17 @@ def within_object(object, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def object_matcher(object)
|
def object_matcher(object)
|
||||||
"[data-id='#{object.id}'][data-type='#{object.class}']"
|
if object.respond_to?(:id)
|
||||||
|
match = "[data-type='#{object.class}'][data-id='#{object.id}']"
|
||||||
|
elsif object.kind_of?(::Class)
|
||||||
|
match = "[data-type='#{object}']"
|
||||||
|
end
|
||||||
|
|
||||||
|
match
|
||||||
end
|
end
|
||||||
|
|
||||||
def within_object_of_type(klass, &block)
|
def within_object_of_type(klass, &block)
|
||||||
within("[data-type='#{klass}']", &block)
|
within_object(klass, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def within_any(search, &block)
|
def within_any(search, &block)
|
||||||
|
|
Loading…
Reference in New Issue