jqueryui_widgets 0.7.1 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MThjMmMzYWU2NmY2ZDM3NWU0ZGY0ODQ0OTQyNzVjMjQwZmMyOTZiZA==
5
+ data.tar.gz: !binary |-
6
+ YjE3YjlkYTY4YTRkNzM3ZGNlODllMjBmMmMzNjQwNWM4MWMyYmNkNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ N2ZlMmMzNTFmNjBkNzFiMjNhMDIzZmY0NzRjODk1NTZhNDVhOTdkNGQwN2Jl
10
+ MjU2NzU3YmFiM2M3MDFjMmY0NjQwOTEwNmVlYThkNGU5ZmM5OTUzN2I4NmZl
11
+ YjAwMmYxMDg5ZDZiOGM2ODljYzJiZDU1Mjk5MDhhMTEzNzUwMzY=
12
+ data.tar.gz: !binary |-
13
+ ZmQ5ZTJlNmFmNTkxODE5ZTk4NWFhMjVkYjI1NGZlMTAyNzEwMTY2MjY4ODFl
14
+ MDIxNGVhOGQzMTY0NjBkZWM0NTQwNzIwNjgwNDIyNmM0N2RkMmUwNzE2MThk
15
+ YTk0MTc1MDMyODg5NTZkZjlhNjE3ZTE2YjM5Yjc2MDE1MTg5YTc=
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == Version 1.0 / 2014-7-25
2
+ * Enhancements
3
+ * Full support for Autocomplete widget
4
+
5
+ == Version 0.8 / 2014-5-24
6
+ * Enhancements
7
+ * Added Autocomplete widget functionality
8
+
1
9
  == Version 0.7.1 / 2013-6-3
2
10
  * Bug Fixes
3
11
  * Fixed bug with Datepicker widget
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem 'rake'
4
4
  gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
5
5
  gem 'guard-cucumber'
6
6
  gem 'growl'
7
+ gem 'rspec-expectations', '2.14.2'
7
8
 
8
9
  # Specify your gem's dependencies in jqueryui_widgets.gemspec
9
10
  gemspec
@@ -0,0 +1,13 @@
1
+ Feature: Using the JQueryUI Autocomplete widget
2
+
3
+ Background:
4
+ Given I am on the autocomplete page
5
+
6
+ @focus
7
+ Scenario: Entering a letter
8
+ When I enter "b" in the autocomplete widget
9
+ Then I should see that each item in the autocomplete list contains "b"
10
+
11
+ Scenario: Selecting an option
12
+ When I enter "b" in the autocomplete widget
13
+ Then I should be able to select "Ruby" from the autocomplete list
@@ -9,7 +9,7 @@ Feature: Using the JQueryUI Datepicker widget
9
9
  And I select day "25"
10
10
  Then the date should be "05/25/2013"
11
11
 
12
- @focus
12
+
13
13
  Scenario: Adjusting the month by arrow clicks
14
14
  When I enter the date "05/10/2013"
15
15
  Then the day should be "10" the month should be "May" and the year should be "2013"
@@ -0,0 +1,50 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>jQuery UI Autocomplete - Default functionality</title>
6
+ <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
7
+ <script src="jquery-1.9.1.js"></script>
8
+ <script src="jquery-ui.js"></script>
9
+ <link rel="stylesheet" href="style.css">
10
+ <script>
11
+ $(function() {
12
+ var availableTags = [
13
+ "ActionScript",
14
+ "AppleScript",
15
+ "Asp",
16
+ "BASIC",
17
+ "C",
18
+ "C++",
19
+ "Clojure",
20
+ "COBOL",
21
+ "ColdFusion",
22
+ "Erlang",
23
+ "Fortran",
24
+ "Groovy",
25
+ "Haskell",
26
+ "Java",
27
+ "JavaScript",
28
+ "Lisp",
29
+ "Perl",
30
+ "PHP",
31
+ "Python",
32
+ "Ruby",
33
+ "Scala",
34
+ "Scheme"
35
+ ];
36
+ $( "#tags" ).autocomplete({
37
+ source: availableTags
38
+ });
39
+ });
40
+ </script>
41
+ </head>
42
+ <body>
43
+
44
+ <div class="ui-widget">
45
+ <label for="tags">Tags: </label>
46
+ <input id="tags">
47
+ </div>
48
+
49
+ </body>
50
+ </html>
@@ -16,4 +16,4 @@ Feature: Using the menus widget
16
16
  Then I should see the "Salzburg", "Delphi", "Ada" option
17
17
 
18
18
  Scenario: Should raise error when non-existing menu item is given
19
- Then I should have an error when I search for menu item "Taco"
19
+ Then I should have an error when I search for menu item "b"
@@ -0,0 +1,21 @@
1
+ Given(/^I am on the autocomplete page$/) do
2
+ visit AutocompletePage
3
+ end
4
+
5
+ When(/^I enter "(\w+)" in the autocomplete widget$/) do |text|
6
+ on(AutocompletePage).autocomplete = text
7
+ end
8
+
9
+ Then(/^I should see that each item in the autocomplete list contains "([^"]*)"$/) do |text|
10
+ on(AutocompletePage) do |page|
11
+ page.autocomplete_unordered_list_element.list_item_element.when_visible
12
+ page.autocomplete_unordered_list_element.list_item_elements.to_s.should include text
13
+ end
14
+ end
15
+
16
+ Then(/^I should be able to select "([^"]*)" from the autocomplete list$/) do |option|
17
+ on(AutocompletePage) do |page|
18
+ page.autocomplete_unordered_list_element.list_item_element.when_visible
19
+ page.autocomplete_unordered_list_element.list_item_element(:text => "#{option}").click
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ class AutocompletePage
2
+ include PageObject
3
+
4
+ page_url "file://#{File.expand_path(File.dirname(__FILE__) + '/../../html/autocomplete.html')}"
5
+
6
+ jqueryui_autocomplete(:autocomplete, :id => 'tags')
7
+ unordered_list(:autocomplete_unordered_list, :class => 'ui-autocomplete')
8
+
9
+ end
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.name = "jqueryui_widgets"
8
8
  gem.version = JQueryUIWidgets::VERSION
9
9
  gem.authors = ["Jeffrey S. Morgan", "Paul Clewell"]
10
- gem.email = ["jeff.morgan@leandog.com", "andrevarshea@gmail.com"]
10
+ gem.email = ["jeff.morgan@leandog.com", "paul.clewell@leandog.com"]
11
11
  gem.description = %q{Wrapper around jQueryUI controls for use with page-object gem}
12
12
  gem.summary = %q{Wrapper around jQueryUI controls for use with page-object gem}
13
13
  gem.homepage = "http://github.com/cheezy/jqueryui_widgets"
@@ -1,5 +1,5 @@
1
1
  require 'page-object'
2
- require "jqueryui_widgets/version"
2
+ require 'jqueryui_widgets/version'
3
3
  require 'jqueryui_widgets/basic_dialog'
4
4
  require 'jqueryui_widgets/tabs'
5
5
  require 'jqueryui_widgets/progress_bar'
@@ -8,6 +8,7 @@ require 'jqueryui_widgets/accordion'
8
8
  require 'jqueryui_widgets/slider'
9
9
  require 'jqueryui_widgets/spinner'
10
10
  require 'jqueryui_widgets/datepicker'
11
+ require 'jqueryui_widgets/autocomplete'
11
12
 
12
13
  module JQueryUIWidgets
13
14
 
@@ -19,5 +20,6 @@ module JQueryUIWidgets
19
20
  PageObject.register_widget(:jqueryui_slider, JQueryUIWidgets::Slider, 'div')
20
21
  PageObject.register_widget(:jqueryui_spinner, JQueryUIWidgets::Spinner, 'span')
21
22
  PageObject.register_widget(:jqueryui_datepicker, JQueryUIWidgets::Datepicker, 'text_field')
23
+ PageObject.register_widget(:jqueryui_autocomplete, JQueryUIWidgets::Autocomplete, 'text_field')
22
24
 
23
25
  end
@@ -0,0 +1,55 @@
1
+
2
+ #
3
+ # Class that wraps around the Autocomplete widget, allowing for
4
+ # the user to interact with the Autocomplete widget, as long
5
+ # as it is active.
6
+ #
7
+ # NOTE: We've only kept to the basic functionality of the
8
+ # Autocmplete widget, allowing for extendability of the class, and
9
+ # to avoid any difficulty by focusing on minutiae.
10
+ #
11
+
12
+ class JQueryUIWidgets::Autocomplete < PageObject::Elements::TextField
13
+
14
+ def self.accessor_methods(accessor, name)
15
+ accessor.send :define_method, "#{name}=" do |text|
16
+ self.send("#{name}_element").value = text
17
+ end
18
+
19
+ accessor.send :define_method, name do
20
+ self.send("#{name}_element").value
21
+ end
22
+
23
+ def results
24
+ autocomplete_div_element.list_item_elements.class('ui-menu-item').map(&:text)
25
+ end
26
+
27
+ def select(item)
28
+ the_autocomplete = results
29
+ index = the_autocomplete.find_index do |autocomplete|
30
+ autocomplete.text == item
31
+ end
32
+ the_autocomplete[index].click
33
+ wait_for_content(index)
34
+ end
35
+
36
+ accessor.send :define_method, "autocomplete_list" do
37
+ self.send "unordered_list_element", :id => 'ui-id-1'
38
+ end
39
+
40
+ accessor.send :private, :autocomplete_list
41
+
42
+
43
+ end
44
+
45
+
46
+ private
47
+
48
+ def wait_for_content(index)
49
+ the_content = list_item_elements(:class => 'ui-menu-item')[index]
50
+ wait_until(1, "Content not visible within one second") do
51
+ the_content.text.empty? == false
52
+ end
53
+ end
54
+
55
+ end
@@ -1,3 +1,3 @@
1
1
  module JQueryUIWidgets
2
- VERSION = "0.7.1"
2
+ VERSION = "1.0"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqueryui_widgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
5
- prerelease:
4
+ version: '1.0'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeffrey S. Morgan
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-06-03 00:00:00.000000000 Z
12
+ date: 2014-07-25 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: page-object
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: cucumber
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rspec
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,7 @@ dependencies:
63
56
  description: Wrapper around jQueryUI controls for use with page-object gem
64
57
  email:
65
58
  - jeff.morgan@leandog.com
66
- - andrevarshea@gmail.com
59
+ - paul.clewell@leandog.com
67
60
  executables: []
68
61
  extensions: []
69
62
  extra_rdoc_files: []
@@ -78,9 +71,11 @@ files:
78
71
  - Rakefile
79
72
  - cucumber.yml
80
73
  - features/accordion.feature
74
+ - features/autocomplete.feature
81
75
  - features/basic_dialog.feature
82
76
  - features/datepicker.feature
83
77
  - features/html/accordion.html
78
+ - features/html/autocomplete.html
84
79
  - features/html/basic_dialog.html
85
80
  - features/html/datepicker.html
86
81
  - features/html/jquery-1.9.1.js
@@ -97,6 +92,7 @@ files:
97
92
  - features/slider.feature
98
93
  - features/spinner.feature
99
94
  - features/step_definitions/accordion_steps.rb
95
+ - features/step_definitions/autocomplete_steps.rb
100
96
  - features/step_definitions/basic_dialog_steps.rb
101
97
  - features/step_definitions/common_steps.rb
102
98
  - features/step_definitions/datepicker_steps.rb
@@ -108,6 +104,7 @@ files:
108
104
  - features/support/env.rb
109
105
  - features/support/hooks.rb
110
106
  - features/support/pages/accordion_page.rb
107
+ - features/support/pages/autocomplete.rb
111
108
  - features/support/pages/basic_dialog_page.rb
112
109
  - features/support/pages/datepicker_page.rb
113
110
  - features/support/pages/menu_page.rb
@@ -119,6 +116,7 @@ files:
119
116
  - jqueryui_widgets.gemspec
120
117
  - lib/jqueryui_widgets.rb
121
118
  - lib/jqueryui_widgets/accordion.rb
119
+ - lib/jqueryui_widgets/autocomplete.rb
122
120
  - lib/jqueryui_widgets/basic_dialog.rb
123
121
  - lib/jqueryui_widgets/core_ext/string.rb
124
122
  - lib/jqueryui_widgets/datepicker.rb
@@ -130,39 +128,34 @@ files:
130
128
  - lib/jqueryui_widgets/version.rb
131
129
  homepage: http://github.com/cheezy/jqueryui_widgets
132
130
  licenses: []
131
+ metadata: {}
133
132
  post_install_message:
134
133
  rdoc_options: []
135
134
  require_paths:
136
135
  - lib
137
136
  required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
137
  requirements:
140
138
  - - ! '>='
141
139
  - !ruby/object:Gem::Version
142
140
  version: '0'
143
- segments:
144
- - 0
145
- hash: 2199466347650544573
146
141
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
142
  requirements:
149
143
  - - ! '>='
150
144
  - !ruby/object:Gem::Version
151
145
  version: '0'
152
- segments:
153
- - 0
154
- hash: 2199466347650544573
155
146
  requirements: []
156
147
  rubyforge_project:
157
- rubygems_version: 1.8.25
148
+ rubygems_version: 2.2.2
158
149
  signing_key:
159
- specification_version: 3
150
+ specification_version: 4
160
151
  summary: Wrapper around jQueryUI controls for use with page-object gem
161
152
  test_files:
162
153
  - features/accordion.feature
154
+ - features/autocomplete.feature
163
155
  - features/basic_dialog.feature
164
156
  - features/datepicker.feature
165
157
  - features/html/accordion.html
158
+ - features/html/autocomplete.html
166
159
  - features/html/basic_dialog.html
167
160
  - features/html/datepicker.html
168
161
  - features/html/jquery-1.9.1.js
@@ -179,6 +172,7 @@ test_files:
179
172
  - features/slider.feature
180
173
  - features/spinner.feature
181
174
  - features/step_definitions/accordion_steps.rb
175
+ - features/step_definitions/autocomplete_steps.rb
182
176
  - features/step_definitions/basic_dialog_steps.rb
183
177
  - features/step_definitions/common_steps.rb
184
178
  - features/step_definitions/datepicker_steps.rb
@@ -190,6 +184,7 @@ test_files:
190
184
  - features/support/env.rb
191
185
  - features/support/hooks.rb
192
186
  - features/support/pages/accordion_page.rb
187
+ - features/support/pages/autocomplete.rb
193
188
  - features/support/pages/basic_dialog_page.rb
194
189
  - features/support/pages/datepicker_page.rb
195
190
  - features/support/pages/menu_page.rb