validate text query types

This commit is contained in:
Thomas Walpole 2020-06-20 16:21:59 -07:00
parent 4db3463965
commit b81aed55bb
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,8 @@ module Capybara
class TextQuery < BaseQuery
def initialize(type = nil, expected_text, session_options:, **options) # rubocop:disable Style/OptionalArguments
@type = type.nil? ? default_type : type
raise ArgumentError, '${@type} is not a valid type for a text query' unless valid_types.include?(@type)
@options = options
super(@options)
self.session_options = session_options
@ -89,6 +91,10 @@ module Capybara
COUNT_KEYS + %i[wait exact normalize_ws]
end
def valid_types
%i[all visible]
end
def check_visible_text?
@type == :visible
end