-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spinner functionality, version bump, documentation.
- Loading branch information
1 parent
3a522aa
commit 337fdfe
Showing
6 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
|
||
Feature: Using the JQueryUI Spinner Widget | ||
|
||
Background: | ||
Given I am on the spinner page | ||
|
||
@focus | ||
Scenario: Spinner enable and disable toggle | ||
When I click the "Toggle disable/enable" button | ||
Then the Spinner widget should be disabled | ||
When I click the "Toggle disable/enable" button | ||
Then the Spinner widget should be enabled | ||
Scenario: Adjust the spinner value with arrows | ||
When I click the increment button | ||
Then the Spinner Widget should read "1" | ||
When I click the decrement button | ||
Then the Spinner Widget should read "0" | ||
|
||
Scenario: Manually set the spinner value | ||
When I set the spinner value to "10" | ||
Then the Spinner Widget should read "10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
Given /^I am on the spinner page$/ do | ||
visit SpinnerPage | ||
end | ||
|
||
When(/^I click the increment button$/) do | ||
on(SpinnerPage).increment_the_spinner | ||
end | ||
|
||
Then(/^the Spinner Widget should read "([^"]*)"$/) do |value| | ||
on(SpinnerPage).the_spinner.should == value | ||
end | ||
|
||
When(/^I click the decrement button$/) do | ||
on(SpinnerPage).decrement_the_spinner | ||
end | ||
|
||
When(/^I set the spinner value to "([^"]*)"$/) do |value| | ||
on(SpinnerPage).the_spinner = value | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,54 @@ | ||
require 'jqueryui_widgets/core_ext/string' | ||
# | ||
# The Spinner Class will serve as a wrapper for the JQuery UI Spinner | ||
# widget, allowing the user to interact with the spinner, setting | ||
# the value either through manual entry, or the up or down arrows attached | ||
# to the widget. | ||
# | ||
# NOTE: The code for the Spinner widget will be kept as basic as possible | ||
# in order to allow the user to tailor the class to suit their own | ||
# needs in case customization of the spinner has been exercised. | ||
# | ||
class JQueryUIWidgets::Spinner < PageObject::Elements::Span | ||
|
||
class JQueryUIWidgets::Spinner < PageObject::Elements::Paragraph | ||
# | ||
# Generates four methods. | ||
# | ||
# The increment_{NAME} method allows the user to click the | ||
# up arrow and increment the value of the widget by 1. | ||
# | ||
# The decrement_{NAME} method allows the user to click the | ||
# down arrow and decrement the value of the widget by 1. | ||
# | ||
# The {NAME} method allows the user to return the current | ||
# value of the widget. | ||
# | ||
# The {NAME}_set method allows the user to set the value | ||
# of the widget. | ||
# | ||
# @example | ||
# the_spinner = 15 | ||
# | ||
# Will set the spinner to 15. | ||
# | ||
def self.accessor_methods(accessor, name) | ||
accessor.send :define_method, "increment_#{name}" do | ||
spinner = self.send "#{name}_element" | ||
spinner.link_element(:class => 'ui-spinner-up').click | ||
end | ||
|
||
accessor.send :define_method, "decrement_#{name}" do | ||
spinner = self.send "#{name}_element" | ||
spinner.link_element(:class => 'ui-spinner-down').click | ||
end | ||
|
||
accessor.send :define_method, "#{name}" do | ||
spinner = self.send "#{name}_element" | ||
spinner.text_field_element(:id => 'spinner').value | ||
end | ||
|
||
accessor.send :define_method, "#{name}=" do |value| | ||
spinner = self.send "#{name}_element" | ||
spinner.text_field_element(:id => 'spinner').value = value | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module JQueryUIWidgets | ||
VERSION = "0.5" | ||
VERSION = "0.6" | ||
end |