1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00

Simplify logic in Node#set

This commit is contained in:
Jon Leighton 2011-11-02 19:24:19 +00:00
parent fb497cb328
commit 4ac77ae72e

View file

@ -34,15 +34,12 @@ module Capybara::Poltergeist
def set(value)
if tag_name == 'input'
type = self[:type]
if type == 'radio'
case self[:type]
when 'radio'
click
elsif type == 'checkbox'
if value && !checked? || !value && checked?
click
end
elsif type == 'file'
when 'checkbox'
click if value != checked?
when 'file'
command :select_file, value
else
command :set, value