Skip to content

Commit

Permalink
validate text query types
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Jun 20, 2020
1 parent 4db3463 commit b81aed5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/capybara/queries/text_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Queries
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
Expand Down Expand Up @@ -89,6 +91,10 @@ def valid_keys
COUNT_KEYS + %i[wait exact normalize_ws]
end

def valid_types
%i[all visible]
end

def check_visible_text?
@type == :visible
end
Expand Down

0 comments on commit b81aed5

Please sign in to comment.