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:
parent
fb497cb328
commit
4ac77ae72e
1 changed files with 5 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue