lib/page-object/elements.rb in page-object-0.5.4 vs lib/page-object/elements.rb in page-object-0.5.5

- old
+ new

@@ -1,5 +1,33 @@ +module PageObject + module Elements + class << self + + # + # method to return the collection of tag_name to class mappings + # + def tag_to_class + @tag_to_class ||= {} + end + + def type_to_class + @type_to_class ||= {} + end + + # + # method to return the element for a tag_name + # + def element_class_for(tag_name, type=nil) + return type_to_class[type] if type + tag_to_class[tag_name.to_sym] || ::PageObject::Elements::Element + end + + end + end +end + + require 'page-object/elements/element' require 'page-object/elements/link' require 'page-object/elements/text_field' require 'page-object/elements/select_list' require 'page-object/elements/check_box' @@ -19,5 +47,6 @@ require 'page-object/elements/ordered_list' require 'page-object/elements/option' require 'page-object/elements/heading' require 'page-object/elements/paragraph' require 'page-object/elements/file_field' +