lib/watir/locators/element/selector_builder.rb in watir-6.0.0.beta4 vs lib/watir/locators/element/selector_builder.rb in watir-6.0.0.beta5
- old
+ new
@@ -28,10 +28,14 @@
case how
when :index
unless what.is_a?(Fixnum)
raise TypeError, "expected Fixnum, got #{what.inspect}:#{what.class}"
end
+ when :visible
+ unless what.is_a?(TrueClass) || what.is_a?(FalseClass)
+ raise TypeError, "expected TrueClass or FalseClass, got #{what.inspect}:#{what.class}"
+ end
else
unless VALID_WHATS.any? { |t| what.is_a? t }
raise TypeError, "expected one of #{VALID_WHATS.inspect}, got #{what.inspect}:#{what.class}"
end
end
@@ -51,10 +55,10 @@
private
def normalize_selector(how, what)
case how
- when :tag_name, :text, :xpath, :index, :class, :label, :css
+ when :tag_name, :text, :xpath, :index, :class, :label, :css, :visible
# include :class since the valid attribute is 'class_name'
# include :for since the valid attribute is 'html_for'
[how, what]
when :class_name
[:class, what]