Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a textarea element #212

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ae_page_objects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions lib/ae_page_objects/elements/textarea.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion lib/ae_page_objects/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module AePageObjects
VERSION = '5.0.0'.freeze
VERSION = '5.1.0.pre.2'.freeze
end
2 changes: 1 addition & 1 deletion test/test_apps/shared/engines/forum/lib/forum/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Forum
VERSION = "4.1.0"
VERSION = "5.1.0.pre.2"
end
17 changes: 17 additions & 0 deletions test/unit/dsl/element_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down