gwt_widgets 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/features/step_definitions/suggest_box_steps.rb +24 -0
- data/features/suggest_box.feature +21 -0
- data/features/support/pages/suggest_box_page.rb +13 -0
- data/lib/gwt_widgets.rb +2 -0
- data/lib/gwt_widgets/date_picker.rb +7 -2
- data/lib/gwt_widgets/suggest_box.rb +19 -0
- data/lib/gwt_widgets/version.rb +1 -1
- metadata +11 -4
data/ChangeLog
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
Given /^I am on the Suggest Box page$/ do
|
2
|
+
visit SuggestBoxPage
|
3
|
+
@current_page.wait_until do
|
4
|
+
@current_page.text.include? 'Choose a word:'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
When /^I type "([^"]*)" into the suggestion box$/ do |value|
|
9
|
+
on(SuggestBoxPage).suggest_box = value
|
10
|
+
end
|
11
|
+
|
12
|
+
Then /^I am presented with the following suggestions:$/ do |table|
|
13
|
+
table.rows.each do |row|
|
14
|
+
on(SuggestBoxPage).suggest_box_suggestions.include?(row[0]).should == true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I click on the "([^"]*)" suggestion$/ do |suggestion|
|
19
|
+
on(SuggestBoxPage).suggest_box_choose suggestion
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^I see "([^"]*)" in the suggestion box$/ do |value|
|
23
|
+
on(SuggestBoxPage).suggest_box.value.should == value
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Using the GWT Suggest Box Widget
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the Suggest Box page
|
5
|
+
|
6
|
+
Scenario: User starts to type and is presented with suggestions
|
7
|
+
When I type "h" into the suggestion box
|
8
|
+
Then I am presented with the following suggestions:
|
9
|
+
| hammer |
|
10
|
+
| haskell |
|
11
|
+
| hollis |
|
12
|
+
|
13
|
+
Scenario: Suggestions are reduced as user types
|
14
|
+
When I type "ha" into the suggestion box
|
15
|
+
Then I am presented with the following suggestions:
|
16
|
+
| hammer |
|
17
|
+
| haskell |
|
18
|
+
|
19
|
+
Scenario: Clicking on a suggestion will populate the text field
|
20
|
+
When I click on the "haskell" suggestion
|
21
|
+
Then I see "haskell" in the suggestion box
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class SuggestBoxPage
|
2
|
+
include PageObject
|
3
|
+
|
4
|
+
page_url "http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwSuggestBox"
|
5
|
+
#page_url "http://localhost:8888/#!CwSuggestBox"
|
6
|
+
|
7
|
+
gwt_suggestbox(:suggest_box, :class => 'gwt-SuggestBox')
|
8
|
+
|
9
|
+
def suggest_box
|
10
|
+
suggest_box_element
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/lib/gwt_widgets.rb
CHANGED
@@ -5,6 +5,7 @@ require 'gwt_widgets/date_picker'
|
|
5
5
|
require 'gwt_widgets/date_box'
|
6
6
|
require 'gwt_widgets/tab_panel'
|
7
7
|
require 'gwt_widgets/stack_panel'
|
8
|
+
require 'gwt_widgets/suggest_box'
|
8
9
|
|
9
10
|
module GwtWidgets
|
10
11
|
|
@@ -13,5 +14,6 @@ module GwtWidgets
|
|
13
14
|
PageObject.register_widget(:gwt_datepicker, GwtWidgets::DatePicker, 'table')
|
14
15
|
PageObject.register_widget(:gwt_tabpanel, GwtWidgets::TabPanel, 'div')
|
15
16
|
PageObject.register_widget(:gwt_stackpanel, GwtWidgets::StackPanel, 'table')
|
17
|
+
PageObject.register_widget(:gwt_suggestbox, GwtWidgets::SuggestBox, 'input')
|
16
18
|
|
17
19
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
class GwtWidgets::DatePicker < PageObject::Elements::Table
|
2
2
|
|
3
3
|
def choose_day (day)
|
4
|
-
|
5
|
-
div_elements(:class => 'datePickerDay')[day.to_i].click
|
4
|
+
days_this_month[day.to_i - 1].click
|
6
5
|
end
|
7
6
|
|
8
7
|
def chosen_day
|
@@ -13,5 +12,11 @@ class GwtWidgets::DatePicker < PageObject::Elements::Table
|
|
13
12
|
div_element(:class => 'datePickerDayIsToday').text
|
14
13
|
end
|
15
14
|
|
15
|
+
private
|
16
|
+
|
17
|
+
def days_this_month
|
18
|
+
days = div_elements(:class => 'datePickerDay')
|
19
|
+
days.reject {|day|day.html.include?'IsFiller'}
|
20
|
+
end
|
16
21
|
|
17
22
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class GwtWidgets::SuggestBox < PageObject::Elements::TextField
|
2
|
+
|
3
|
+
def self.accessor_methods(accessor, name)
|
4
|
+
accessor.send :define_method, "#{name}" do
|
5
|
+
suggestion_box = self.send "#{name}_element"
|
6
|
+
end
|
7
|
+
accessor.send :define_method, "#{name}=" do | value |
|
8
|
+
suggestion_box = self.send "#{name}_element"
|
9
|
+
suggestion_box.parent.text_field_element.value = value
|
10
|
+
end
|
11
|
+
accessor.send :define_method, "#{name}_suggestions" do
|
12
|
+
browser.div(:class => 'gwt-SuggestBoxPopup').tds(:class => 'item').map(&:text)
|
13
|
+
end
|
14
|
+
accessor.send :define_method, "#{name}_choose" do | label |
|
15
|
+
browser.div(:class => 'gwt-SuggestBoxPopup').td(:class => 'item', :text => label).click
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/gwt_widgets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gwt_widgets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: page-object
|
@@ -145,12 +145,15 @@ files:
|
|
145
145
|
- features/step_definitions/datepicker_steps.rb
|
146
146
|
- features/step_definitions/dialogbox_steps.rb
|
147
147
|
- features/step_definitions/stack_panel_steps.rb
|
148
|
+
- features/step_definitions/suggest_box_steps.rb
|
148
149
|
- features/step_definitions/tab_panel_steps.rb
|
150
|
+
- features/suggest_box.feature
|
149
151
|
- features/support/env.rb
|
150
152
|
- features/support/hooks.rb
|
151
153
|
- features/support/pages/date_picker_page.rb
|
152
154
|
- features/support/pages/dialog_box_page.rb
|
153
155
|
- features/support/pages/stack_panel_page.rb
|
156
|
+
- features/support/pages/suggest_box_page.rb
|
154
157
|
- features/support/pages/tab_panel_page.rb
|
155
158
|
- features/support/persistent_browser.rb
|
156
159
|
- features/tab_panel.feature
|
@@ -160,6 +163,7 @@ files:
|
|
160
163
|
- lib/gwt_widgets/date_picker.rb
|
161
164
|
- lib/gwt_widgets/dialog_box.rb
|
162
165
|
- lib/gwt_widgets/stack_panel.rb
|
166
|
+
- lib/gwt_widgets/suggest_box.rb
|
163
167
|
- lib/gwt_widgets/tab_panel.rb
|
164
168
|
- lib/gwt_widgets/version.rb
|
165
169
|
homepage: http://github.com/joelbyler/gwt_widgets
|
@@ -176,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
180
|
version: '0'
|
177
181
|
segments:
|
178
182
|
- 0
|
179
|
-
hash:
|
183
|
+
hash: 3645583039750060461
|
180
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
185
|
none: false
|
182
186
|
requirements:
|
@@ -185,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
189
|
version: '0'
|
186
190
|
segments:
|
187
191
|
- 0
|
188
|
-
hash:
|
192
|
+
hash: 3645583039750060461
|
189
193
|
requirements: []
|
190
194
|
rubyforge_project: gwt_widgets
|
191
195
|
rubygems_version: 1.8.25
|
@@ -200,12 +204,15 @@ test_files:
|
|
200
204
|
- features/step_definitions/datepicker_steps.rb
|
201
205
|
- features/step_definitions/dialogbox_steps.rb
|
202
206
|
- features/step_definitions/stack_panel_steps.rb
|
207
|
+
- features/step_definitions/suggest_box_steps.rb
|
203
208
|
- features/step_definitions/tab_panel_steps.rb
|
209
|
+
- features/suggest_box.feature
|
204
210
|
- features/support/env.rb
|
205
211
|
- features/support/hooks.rb
|
206
212
|
- features/support/pages/date_picker_page.rb
|
207
213
|
- features/support/pages/dialog_box_page.rb
|
208
214
|
- features/support/pages/stack_panel_page.rb
|
215
|
+
- features/support/pages/suggest_box_page.rb
|
209
216
|
- features/support/pages/tab_panel_page.rb
|
210
217
|
- features/support/persistent_browser.rb
|
211
218
|
- features/tab_panel.feature
|