Class: Chop::Form::TagField

Inherits:
Field
  • Object
show all
Defined in:
lib/bard/tag_field/cucumber.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.css_selectorObject



2
3
4
# File 'lib/bard/tag_field/cucumber.rb', line 2

def self.css_selector
  "input-tag"
end

Instance Method Details

#diff_valueObject



14
15
16
# File 'lib/bard/tag_field/cucumber.rb', line 14

def diff_value
  get_value.join(", ")
end

#fill_in!Object



26
27
28
# File 'lib/bard/tag_field/cucumber.rb', line 26

def fill_in!
  session.execute_script("document.getElementById('#{field[:id]}').value = #{set_value.to_json}")
end

#get_valueObject



10
11
12
# File 'lib/bard/tag_field/cucumber.rb', line 10

def get_value
  field.all("tag-option").map(&:text)
end

#matches?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/bard/tag_field/cucumber.rb', line 6

def matches?
  field.tag_name == "input-tag"
end

#set_valueObject



18
19
20
21
22
23
24
# File 'lib/bard/tag_field/cucumber.rb', line 18

def set_value
  if field[:multiple]
    value.to_s.split(", ").map(&:strip)
  else
    value.to_s.strip
  end
end