validate text query types
This commit is contained in:
parent
4db3463965
commit
b81aed55bb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue