lib/druid/nested_elements.rb in druid-ts-1.1.6 vs lib/druid/nested_elements.rb in druid-ts-1.1.7
- old
+ new
@@ -1,239 +1,56 @@
+require 'druid/locator_generator'
+
module Druid
module NestedElements
- def link_element(identifier={:index => 0})
- link_for(identifier)
- end
- def link_elements(identifier={:index => 0})
- links_for(identifier)
+ def self.included(cls)
+ Druid::LocatorGenerator.generate_locators(cls)
end
- def button_element(identifier={:index => 0})
- button_for(identifier)
- end
+ private
- def button_elements(identifier={:index => 0})
- buttons_for(identifier)
+ def locator(identifier)
+ identifier[0] ? identifier[0] : {:index => 0}
end
- def text_field_element(identifier={:index => 0})
- text_field_for(identifier)
- end
+ # [:text_field,
+ # :hidden_field,
+ # :text_area,
+ # :select_list,
+ # :link,
+ # :checkbox,
+ # :radio_button,
+ # :button,
+ # :div,
+ # :span,
+ # :table,
+ # :cell,
+ # :image,
+ # :form,
+ # :list_item,
+ # :unordered_list,
+ # :ordered_list,
+ # :h1,
+ # :h2,
+ # :h3,
+ # :h4,
+ # :h5,
+ # :h6,
+ # :paragraph,
+ # :label,
+ # :file_field,
+ # :area,
+ # :canvas,
+ # :audio,
+ # :video].each do |tag|
+ # define_method("#{tag.to_s}_element") do |*identifier|
+ # self.send "#{tag.to_s}_for", locator(identifier)
+ # end
+ #
+ # define_method("#{tag.to_s}_elements") do |*identifier|
+ # self.send "#{tag.to_s}s_for", locator(identifier)
+ # end
+ # end
- def text_field_elements(identifier={:index => 0})
- text_fields_for(identifier)
- end
-
- def hidden_field_element(identifier={:index => 0})
- hidden_field_for(identifier)
- end
-
- def hidden_field_elements(identifier={:index => 0})
- hidden_fields_for(identifier)
- end
-
- def text_area_element(identifier={:index => 0})
- text_area_for(identifier)
- end
-
- def text_area_elements(identifier={:index => 0})
- text_areas_for(identifier)
- end
-
- def select_list_element(identifier={:index => 0})
- select_list_for(identifier)
- end
-
- def select_list_elements(identifier={:index => 0})
- select_lists_for(identifier)
- end
-
- def checkbox_element(identifier={:index => 0})
- checkbox_for(identifier)
- end
-
- def checkbox_elements(identifier={:index => 0})
- checkboxes_for(identifier)
- end
-
- def radio_button_element(identifier={:index => 0})
- radio_button_for(identifier)
- end
-
- def radio_button_elements(identifier={:index => 0})
- radio_buttons_for(identifier)
- end
-
- def div_element(identifier={:index => 0})
- div_for(identifier)
- end
-
- def div_elements(identifier={:index => 0})
- divs_for(identifier)
- end
-
- def span_element(identifier={:index => 0})
- span_for(identifier)
- end
-
- def span_elements(identifier={:index => 0})
- spans_for(identifier)
- end
-
- def table_element(identifier={:index => 0})
- table_for(identifier)
- end
-
- def table_elements(identifier={:index => 0})
- tables_for(identifier)
- end
-
- def cell_element(identifier={:index => 0})
- cell_for(identifier)
- end
-
- def cell_elements(identifier={:index => 0})
- cells_for(identifier)
- end
-
- def image_element(identifier={:index => 0})
- image_for(identifier)
- end
-
- def image_elements(identifier={:index => 0})
- images_for(identifier)
- end
-
- def form_element(identifier={:index => 0})
- form_for(identifier)
- end
-
- def form_elements(identifier={:index => 0})
- forms_for(identifier)
- end
-
- def ordered_list_element(identifier={:index => 0})
- ordered_list_for(identifier)
- end
-
- def ordered_list_elements(identifier={:index => 0})
- ordered_lists_for(identifier)
- end
-
- def unordered_list_element(identifier={:index => 0})
- unordered_list_for(identifier)
- end
-
- def unordered_list_elements(identifier={:index => 0})
- unordered_lists_for(identifier)
- end
-
- def list_item_element(identifier={:index => 0})
- list_item_for(identifier)
- end
-
- def list_item_elements(identifier={:index => 0})
- list_items_for(identifier)
- end
-
- def h1_element(identifier={:index => 0})
- h1_for(identifier)
- end
-
- def h1_elements(identifier={:index => 0})
- h1s_for(identifier)
- end
-
- def h2_element(identifier={:index => 0})
- h2_for(identifier)
- end
-
- def h2_elements(identifier={:index => 0})
- h2s_for(identifier)
- end
-
- def h3_element(identifier={:index => 0})
- h3_for(identifier)
- end
-
- def h3_elements(identifier={:index => 0})
- h3s_for(identifier)
- end
-
- def h4_element(identifier={:index => 0})
- h4_for(identifier)
- end
-
- def h4_elements(identifier={:index => 0})
- h4s_for(identifier)
- end
-
- def h5_element(identifier={:index => 0})
- h5_for(identifier)
- end
-
- def h5_elements(identifier={:index => 0})
- h5s_for(identifier)
- end
-
- def h6_element(identifier={:index => 0})
- h6_for(identifier)
- end
-
- def h6_elements(identifier={:index => 0})
- h6s_for(identifier)
- end
-
- def paragraph_element(identifier={:index => 0})
- paragraph_for(identifier)
- end
-
- def paragraph_elements(identifier={:index => 0})
- paragraphs_for(identifier)
- end
-
- def file_field_element(identifier={:index => 0})
- file_field_for(identifier)
- end
-
- def label_element(identifier={:index => 0})
- label_for(identifier)
- end
-
- def label_elements(identifier={:index => 0})
- labels_for(identifier)
- end
-
- def area_element(identifier={:index => 0})
- area_for(identifier)
- end
-
- def area_elements(identifier={:index => 0})
- areas_for(identifier)
- end
-
- def canvas_element(identifier={:index => 0})
- canvas_for(identifier)
- end
-
- def canvas_elements(identifier={:index => 0})
- canvases_for(identifier)
- end
-
- def audio_element(identifier={:index => 0})
- audio_for(identifier)
- end
-
- def audio_elements(identifier={:index => 0})
- audios_for(identifier)
- end
-
- def video_element(identifier={:index => 0})
- video_for(identifier)
- end
-
- def video_elements(identifier={:index => 0})
- videos_for(identifier)
- end
end
end