Sha256: fd327796cc8d29018048d1e2fbc66ee081265af128f8a7cace609efc115d8369

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

module Cello
  module Structure
    module RadioHelper
      def define_extras_for_radios(name)
        define_method "#{name}_is_real?" do
          send(name).size > 0
        end
        define_method "#{name}_click" do
          send(name)[0].click
        end
        define_method "#{name}_is_visible?" do
          send(name).all? {|e| e.visible?}
        end
        define_method "#{name}_right_click" do
          send(name)[0].right_click
        end
        define_method "#{name}_is_enable?" do
          send(name).all? {|e| e.enabled?}
        end
        define_method "#{name}_contains" do |radio_value|
          send(name).any? {|e| e.value == radio_value}
        end
        define_method "#{name}_has_selected_option?" do
          send(name).any? {|e| e.checked? == true}
        end
        define_method "#{name}_set" do |radio_value|
          send(name).each do |element|
            element.value == radio_value ? element.set : nil
          end
        end
        define_method "#{name}_checked_option_is?" do |radio_value|
          foo = false
          send(name).each do |element|
            if (element.value == radio_value && element.checked?) 
              foo = true
            end
          end
          return foo
        end
        define_method "#{name}_checked_option_is_not?" do |radio_value|
          foo = false
          send(name).each do |element|
            if (element.value == radio_value && element.checked?) 
              foo = true
            end
          end
          return !foo
        end
        define_method "#{name}_checked_option?" do
          send(name).each {|e| p e.value.size if (e.checked?) }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cello-0.0.19 lib/cello/structure/html_elements/radio_helper.rb
cello-0.0.17 lib/cello/structure/html_elements/radio_helper.rb
cello-0.0.16 lib/cello/structure/html_elements/radio_helper.rb