Sha256: a15c8282dafba934d27cf8b31af81a39cdf974d50dd2ce7cfb67861a8da1baf8

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

Dir[File.dirname(__FILE__) + "/*.rb"].each do |file| 
  require file 
end

module Cello
  module Structure
    module ElementHelper

      private

      def element(name, type, *args)
        class_eval do
          define_method name do
            parent.browser.send(type, *args)
          end

          define_extras(name, type)
        end
      end

      def define_extras(name, type)
        define_method "#{name}_is_real?" do
          send(name).exists?
        end
        define_method "#{name}_click" do
          send(name).click
        end
        define_method "#{name}_is_visible?" do
          send(name).visible?
        end
        define_method "#{name}_is_enable?" do
          send(name).enabled?
        end
        define_method "#{name}_right_click" do
          send(name).right_click
        end

        define_method "#{name}_get" do |att|
          send(name).attribute_value(att)
        end

        method_name = "define_extras_for_#{type}"
        send(method_name, name) if respond_to? method_name
      end

     include CheckboxHelper
     include TextfieldHelper
     include TextareaHelper
     include SelectHelper
     include DivHelper
     include RadioHelper
     include LinkHelper
     include ButtonHelper
     include SpanHelper
     include HiddenHelper

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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