Sha256: 76a578f2d13f6970ac451b178b8138b709d91fb0592a489b4929e12c83724867
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'domkey/view/option_selectable' module Domkey module View class SelectList < PageObject include OptionSelectable private # by position in options array def set_by_index value [*value].each { |i| element.options[i].select } end # by value attribute of the option def set_by_value value [*value].each { |v| element.select_value(v) } end # by visible text for the option (visible to the user) def set_by_label value [*value].each { |v| element.select(v) } end def value_by_options opts element.selected_options.map do |o| Hash[opts.map { |opt| [opt, o.send(opt)] }] end end def value_by_default element.selected_options.map { |e| e.value } end def options_by_default element.options.map { |e| e.value } end def options_by opts element.options.map do |o| Hash[opts.map { |opt| [opt, o.send(opt)] }] end end def set_by_symbol value case value when FalseClass element.clear if element.multiple? when TrueClass return #noop else fail(Exception::NotImplementedError, "Unknown way of setting by value: #{value.inspect}") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
domkey-0.4.0 | lib/domkey/view/select_list.rb |