jqueryui_widgets 0.6 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == Version 0.7.1 / 2013-6-3
2
+ * Bug Fixes
3
+ * Fixed bug with Datepicker widget
4
+
5
+ == Version 0.7 / 2013-6-3
6
+ * Enhancements
7
+ * Added in functionality and documentation for Datepicker widget
8
+
1
9
  == Version 0.6 / 2013-5-24
2
10
  * Enhancements
3
11
  * New functionality from Page Object
@@ -0,0 +1,24 @@
1
+ Feature: Using the JQueryUI Datepicker widget
2
+
3
+ Background:
4
+ Given I am on the datepicker page
5
+
6
+
7
+ Scenario: Selecting a calendar date
8
+ When I enter the date "05/10/2013"
9
+ And I select day "25"
10
+ Then the date should be "05/25/2013"
11
+
12
+ @focus
13
+ Scenario: Adjusting the month by arrow clicks
14
+ When I enter the date "05/10/2013"
15
+ Then the day should be "10" the month should be "May" and the year should be "2013"
16
+ And I click on the Previous Month arrow
17
+ Then the day should be "" the month should be "April" and the year should be "2013"
18
+ And I click on the Next Month arrow
19
+ Then the day should be "10" the month should be "May" and the year should be "2013"
20
+
21
+ Scenario: Selecting a second date picker
22
+ When I enter the date "05/10/2013" in the second date picker
23
+ And I select day "25"
24
+ Then the date of the second datepicker should be "05/25/2013"
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title>jQuery UI Datepicker - Default functionality</title>
7
+ <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
8
+ <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
9
+ <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
10
+ <link rel="stylesheet" href="/resources/demos/style.css" />
11
+ <script>
12
+ $(function() {
13
+ $( "#datepicker1" ).datepicker();
14
+ $( "#datepicker2" ).datepicker();
15
+ });
16
+ </script>
17
+ </head>
18
+ <body>
19
+
20
+ <p>Date: <input type="text" id="datepicker1" /></p>
21
+
22
+
23
+ <p>Date: <input type="text" id="datepicker2" /></p>
24
+
25
+ </body>
26
+ </html>
@@ -10,5 +10,5 @@ Feature: Using the JQueryUI Slider Widget
10
10
  Then the current value of the slider should be "0%"
11
11
 
12
12
  Scenario: Setting the Slider to a specific value
13
- When I move the slider to "20%"
13
+ When I move the slider to "10%"
14
14
  Then the current value of the slider should be "10%"
@@ -0,0 +1,39 @@
1
+ Given(/^I am on the datepicker page$/) do
2
+ visit DatepickerPage
3
+ end
4
+
5
+ When(/^I select day "(\d+)"$/) do |day|
6
+ on(DatepickerPage).datepicker_one_select_day day
7
+ end
8
+
9
+ Then(/^the date should be "([^\"]*)"$/) do |day|
10
+ on(DatepickerPage).datepicker_one.should == day
11
+ end
12
+
13
+ When(/^I enter the date "([^\"]*)"$/) do |date|
14
+ on(DatepickerPage).datepicker_one = date
15
+ end
16
+
17
+ When(/^I click on the Previous Month arrow$/) do
18
+ on(DatepickerPage).datepicker_one_previous_month
19
+ end
20
+
21
+ Then(/^the day should be "(\d*)" the month should be "(\w+)" and the year should be "(\d+)"$/) do |day, month, year|
22
+ on(DatepickerPage) do |page|
23
+ page.datepicker_one_day.should == day unless page.datepicker_one_day == nil
24
+ page.datepicker_one_month.should == month
25
+ page.datepicker_one_year.should == year
26
+ end
27
+ end
28
+
29
+ When(/^I click on the Next Month arrow$/) do
30
+ on(DatepickerPage).datepicker_one_next_month
31
+ end
32
+
33
+ When(/^I enter the date "([^\"]*)" in the second date picker$/) do |date|
34
+ on(DatepickerPage).datepicker_two = date
35
+ end
36
+
37
+ Then(/^the date of the second datepicker should be "([^\"]*)"$/) do |date|
38
+ on(DatepickerPage).datepicker_two.should == date
39
+ end
@@ -0,0 +1,9 @@
1
+ class DatepickerPage
2
+ include PageObject
3
+
4
+ page_url "file://#{File.expand_path(File.dirname(__FILE__) + '/../../html/datepicker.html')}"
5
+
6
+ jqueryui_datepicker(:datepicker_one, :id => 'datepicker1')
7
+ jqueryui_datepicker(:datepicker_two, :id => 'datepicker2')
8
+
9
+ end
@@ -0,0 +1,91 @@
1
+
2
+ #
3
+ # Class that wraps around the Datepicker widget, allowing for the
4
+ # user to interact with single or multiple Datepicker widgets, as
5
+ # long as only a single Datepicker is active.
6
+ #
7
+ # NOTE: We've kept to the basic functionality of the Datepicker
8
+ # widget, allowing for extendability of the class, and to avoid
9
+ # any difficulty by focusing on minutiae.
10
+ #
11
+
12
+ class JQueryUIWidgets::Datepicker < PageObject::Elements::TextField
13
+
14
+ #
15
+ # Generates nine methods.
16
+ #
17
+ # The {NAME}= method allows the user to set the value
18
+ # of the text field that generates the Datepicker widget.
19
+ #
20
+ # The {NAME} method returns the value of the Datepicker text field.
21
+ #
22
+ # The {NAME}_select_day method allows the user to pass in a variable to
23
+ # search through the Datepicker widget table and click on that variable,
24
+ # in this case the day.
25
+ #
26
+ # @params: [variable] the day to find.
27
+ #
28
+ # @example:
29
+ # datepicker_select_day '10'
30
+ # Will search through the datepicker table and click on the 10th
31
+ # day of the month.
32
+ #
33
+ # The {NAME}_next_month method will click the next month arrow,
34
+ # setting the datepicker widget to the next month.
35
+ #
36
+ # The {NAME}_previous_month method will click the previous month
37
+ # arrow, setting the datepicker widget to the previous month.
38
+ #
39
+ # The {NAME}_day method will search through the datepicker table
40
+ # and return the day with the class of 'ui-state-active', which is
41
+ # the current day according to the widget.
42
+ #
43
+ # The {NAME}_month method will return the month header of the
44
+ # datepicker table, and return the current month.
45
+ #
46
+ # The {NAME}_year method will return the year header of the
47
+ # datepicker table, and return the current year.
48
+ #
49
+ def self.accessor_methods(accessor, name)
50
+ accessor.send :define_method, "#{name}=" do |date|
51
+ self.send("#{name}_element").value = date
52
+ end
53
+
54
+ accessor.send :define_method, name do
55
+ self.send("#{name}_element").value
56
+ end
57
+
58
+ accessor.send :define_method, "#{name}_select_day" do |day|
59
+ datepicker_div.table_element.link_element(:text => day).click
60
+ end
61
+
62
+ accessor.send :define_method, "#{name}_next_month" do
63
+ datepicker_div.link_element(:class => 'ui-datepicker-next').click
64
+ end
65
+
66
+ accessor.send :define_method, "#{name}_previous_month" do
67
+ datepicker_div.link_element(:class => 'ui-datepicker-prev').click
68
+ end
69
+
70
+ accessor.send :define_method, "#{name}_day" do
71
+ datepicker_div.table_element.link_element(:class => 'ui-state-active').text unless datepicker_div.table_element.link_element.attribute('class' => 'ui-state-active') == nil
72
+ end
73
+
74
+ accessor.send :define_method, "#{name}_month" do
75
+ datepicker_div.div_element(:class => 'ui-datepicker-title').span_element(:class => 'ui-datepicker-month').text
76
+ end
77
+
78
+ accessor.send :define_method, "#{name}_year" do
79
+ datepicker_div.div_element(:class => 'ui-datepicker-title').span_element(:class => 'ui-datepicker-year').text
80
+ end
81
+
82
+ accessor.send :define_method, "datepicker_div" do
83
+ self.send "div_element", :id => 'ui-datepicker-div'
84
+ end
85
+
86
+ accessor.send :private, :datepicker_div
87
+
88
+ end
89
+
90
+
91
+ end
@@ -1,3 +1,3 @@
1
1
  module JQueryUIWidgets
2
- VERSION = "0.6"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -7,6 +7,7 @@ require 'jqueryui_widgets/menus'
7
7
  require 'jqueryui_widgets/accordion'
8
8
  require 'jqueryui_widgets/slider'
9
9
  require 'jqueryui_widgets/spinner'
10
+ require 'jqueryui_widgets/datepicker'
10
11
 
11
12
  module JQueryUIWidgets
12
13
 
@@ -17,5 +18,6 @@ module JQueryUIWidgets
17
18
  PageObject.register_widget(:jqueryui_accordion, JQueryUIWidgets::Accordion, 'div')
18
19
  PageObject.register_widget(:jqueryui_slider, JQueryUIWidgets::Slider, 'div')
19
20
  PageObject.register_widget(:jqueryui_spinner, JQueryUIWidgets::Spinner, 'span')
21
+ PageObject.register_widget(:jqueryui_datepicker, JQueryUIWidgets::Datepicker, 'text_field')
20
22
 
21
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqueryui_widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-24 00:00:00.000000000 Z
13
+ date: 2013-06-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: page-object
@@ -79,8 +79,10 @@ files:
79
79
  - cucumber.yml
80
80
  - features/accordion.feature
81
81
  - features/basic_dialog.feature
82
+ - features/datepicker.feature
82
83
  - features/html/accordion.html
83
84
  - features/html/basic_dialog.html
85
+ - features/html/datepicker.html
84
86
  - features/html/jquery-1.9.1.js
85
87
  - features/html/jquery-ui.css
86
88
  - features/html/jquery-ui.js
@@ -97,6 +99,7 @@ files:
97
99
  - features/step_definitions/accordion_steps.rb
98
100
  - features/step_definitions/basic_dialog_steps.rb
99
101
  - features/step_definitions/common_steps.rb
102
+ - features/step_definitions/datepicker_steps.rb
100
103
  - features/step_definitions/menu_steps.rb
101
104
  - features/step_definitions/progress_bar_steps.rb
102
105
  - features/step_definitions/slider_steps.rb
@@ -106,6 +109,7 @@ files:
106
109
  - features/support/hooks.rb
107
110
  - features/support/pages/accordion_page.rb
108
111
  - features/support/pages/basic_dialog_page.rb
112
+ - features/support/pages/datepicker_page.rb
109
113
  - features/support/pages/menu_page.rb
110
114
  - features/support/pages/progress_bar_page.rb
111
115
  - features/support/pages/slider_page.rb
@@ -117,6 +121,7 @@ files:
117
121
  - lib/jqueryui_widgets/accordion.rb
118
122
  - lib/jqueryui_widgets/basic_dialog.rb
119
123
  - lib/jqueryui_widgets/core_ext/string.rb
124
+ - lib/jqueryui_widgets/datepicker.rb
120
125
  - lib/jqueryui_widgets/menus.rb
121
126
  - lib/jqueryui_widgets/progress_bar.rb
122
127
  - lib/jqueryui_widgets/slider.rb
@@ -137,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
142
  version: '0'
138
143
  segments:
139
144
  - 0
140
- hash: -2842964414733939533
145
+ hash: 2199466347650544573
141
146
  required_rubygems_version: !ruby/object:Gem::Requirement
142
147
  none: false
143
148
  requirements:
@@ -146,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
151
  version: '0'
147
152
  segments:
148
153
  - 0
149
- hash: -2842964414733939533
154
+ hash: 2199466347650544573
150
155
  requirements: []
151
156
  rubyforge_project:
152
157
  rubygems_version: 1.8.25
@@ -156,8 +161,10 @@ summary: Wrapper around jQueryUI controls for use with page-object gem
156
161
  test_files:
157
162
  - features/accordion.feature
158
163
  - features/basic_dialog.feature
164
+ - features/datepicker.feature
159
165
  - features/html/accordion.html
160
166
  - features/html/basic_dialog.html
167
+ - features/html/datepicker.html
161
168
  - features/html/jquery-1.9.1.js
162
169
  - features/html/jquery-ui.css
163
170
  - features/html/jquery-ui.js
@@ -174,6 +181,7 @@ test_files:
174
181
  - features/step_definitions/accordion_steps.rb
175
182
  - features/step_definitions/basic_dialog_steps.rb
176
183
  - features/step_definitions/common_steps.rb
184
+ - features/step_definitions/datepicker_steps.rb
177
185
  - features/step_definitions/menu_steps.rb
178
186
  - features/step_definitions/progress_bar_steps.rb
179
187
  - features/step_definitions/slider_steps.rb
@@ -183,6 +191,7 @@ test_files:
183
191
  - features/support/hooks.rb
184
192
  - features/support/pages/accordion_page.rb
185
193
  - features/support/pages/basic_dialog_page.rb
194
+ - features/support/pages/datepicker_page.rb
186
195
  - features/support/pages/menu_page.rb
187
196
  - features/support/pages/progress_bar_page.rb
188
197
  - features/support/pages/slider_page.rb