Permalink
Browse files

added support for generation of plural basic type generator methods

  • Loading branch information...
1 parent 93a4546 commit 84ac39901e26023b8f921d686e218408a630b4f5 @cheezy committed Jan 23, 2014
Showing with 10 additions and 8 deletions.
  1. +2 −4 ChangeLog
  2. +7 −3 lib/page-object/accessors.rb
  3. +1 −1 lib/page-object/locator_generator.rb
View
@@ -1,10 +1,8 @@
-=== Version 0.9.6
-* Enhancements
- * Added href method to Link
-
=== Version 0.9.5
* Enhancements
* Updated to use the latest selenium-webdriver 2.39.0
+ * Added href method to Link
+ * Added generation of plural version of basic types on class
=== Version 0.9.4 / 2013-11-29
* Enhancements
@@ -1155,11 +1155,15 @@ def elements(name, tag, identifier={:index => 0}, &block)
# * :xpath => Watir and Selenium
# @param optional block to be invoked when element method is called
#
- LocatorGenerator::BASIC_ELEMENTS.each do |type|
- define_method(type) do |name, *identifier, &block|
+ LocatorGenerator::BASIC_ELEMENTS.each do |tag|
+ define_method(tag) do |name, *identifier, &block|
identifier = identifier[0] ? identifier[0] : {:index => 0}
- element(name, type, identifier, &block)
+ element(name, tag, identifier, &block)
end
+ define_method("#{tag}s") do |name, *identifier, &block|
+ identifier = identifier[0] ? identifier[0] : {:index => 0}
+ elements(name, tag, identifier, &block)
+ end unless tag == :param
end
def standard_methods(name, identifier, method, &block)
@@ -104,7 +104,7 @@ module LocatorGenerator
:svg]
def self.generate_locators(target)
- ADVANCED_ELEMENTS.each do |tag|
+ ADVANCED_ELEMENTS.each do |tag|
target.send(:define_method, "#{tag.to_s}_element") do |*identifier|
@platform.send "#{tag.to_s}_for", locator(identifier)
end

0 comments on commit 84ac399

Please sign in to comment.