diff --git a/lib/ae_page_objects.rb b/lib/ae_page_objects.rb index db256eb2..553e7097 100644 --- a/lib/ae_page_objects.rb +++ b/lib/ae_page_objects.rb @@ -14,6 +14,7 @@ module AePageObjects autoload :Form, 'ae_page_objects/elements/form' autoload :Select, 'ae_page_objects/elements/select' autoload :Checkbox, 'ae_page_objects/elements/checkbox' + autoload :Textarea, 'ae_page_objects/elements/textarea' class << self attr_accessor :default_router diff --git a/lib/ae_page_objects/elements/textarea.rb b/lib/ae_page_objects/elements/textarea.rb new file mode 100644 index 00000000..a1a215f1 --- /dev/null +++ b/lib/ae_page_objects/elements/textarea.rb @@ -0,0 +1,13 @@ +module AePageObjects + class Textarea < Element + def set(value) + node.set(value, { clear: clear_keys }) + end + + private + + def clear_keys + [[:command, 'a'], :backspace] + end + end +end diff --git a/lib/ae_page_objects/version.rb b/lib/ae_page_objects/version.rb index 282122dc..123ed35b 100644 --- a/lib/ae_page_objects/version.rb +++ b/lib/ae_page_objects/version.rb @@ -1,3 +1,3 @@ module AePageObjects - VERSION = '5.0.0'.freeze + VERSION = '5.1.0.pre.2'.freeze end diff --git a/test/test_apps/shared/engines/forum/lib/forum/version.rb b/test/test_apps/shared/engines/forum/lib/forum/version.rb index 9c4eac95..6fb778d4 100644 --- a/test/test_apps/shared/engines/forum/lib/forum/version.rb +++ b/test/test_apps/shared/engines/forum/lib/forum/version.rb @@ -1,3 +1,3 @@ module Forum - VERSION = "4.1.0" + VERSION = "5.1.0.pre.2" end diff --git a/test/unit/dsl/element_test.rb b/test/unit/dsl/element_test.rb index b4a9b7a4..65dbe39f 100644 --- a/test/unit/dsl/element_test.rb +++ b/test/unit/dsl/element_test.rb @@ -88,6 +88,23 @@ def test_element__is__checkbox verify_element_on_parent(jon, :kind, AePageObjects::Checkbox, kind_page_object) end + def test_element__is__textarea + kitty = Class.new(AePageObjects::Document) do + element :description, is: AePageObjects::Textarea + end + + assert kitty.method_defined?(:description) + assert_equal [:description], kitty.element_attributes.keys + + stub_current_window + + jon = kitty.new + + description_page_object = stub(:allow_reload!) + capybara_stub.session.expects(:first).with("#description", minimum: 0).returns(description_page_object) + verify_element_on_parent(jon, :description, AePageObjects::Textarea, description_page_object) + end + def test_element__is__special_widget special_widget = Class.new(AePageObjects::Element)