rails3-jquery-autocomplete 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -20,7 +20,7 @@ I'd encourage you to understand how to use those 3 amazing tools before attempti
20
20
 
21
21
  Include the gem on your Gemfile
22
22
 
23
- gem 'rails3-jquery-autocomplete', '0.3.2'
23
+ gem 'rails3-jquery-autocomplete'
24
24
 
25
25
  Install it
26
26
 
@@ -34,12 +34,14 @@ And include autocomplete-rails.js on your layouts
34
34
 
35
35
  javascript_include_tag "autocomplete-rails.js"
36
36
 
37
- ## Upgrading from 0.2.x
37
+ ## Upgrading from older versions
38
38
 
39
39
  If you are upgrading from a previous version, run the generator after installing to replace the javascript file.
40
40
 
41
41
  rails generate autocomplete
42
42
 
43
+ I'd recommend you do this every time you update to make sure you have the latest JS file.
44
+
43
45
  ## Usage
44
46
 
45
47
  ### Model Example
@@ -141,7 +143,33 @@ If you need to use the id of the selected object, you can use the *:id_element*
141
143
 
142
144
  This will update the field with id *#some_element with the id of the selected object. The value for this option can be any jQuery selector.
143
145
 
144
- ## Development
146
+ # Cucumber
147
+
148
+ I have created a step to test your autocomplete with Cucumber and Capybara, all you have to do is add the following lines to your *env.rb* file:
149
+
150
+ require 'cucumber/autocomplete'
151
+
152
+ Then you'll have access to the following step:
153
+
154
+ And I choose "Alpha" in the autocomplete list
155
+
156
+ An example on how to use it:
157
+
158
+ @javascript
159
+ Scenario: Autocomplete
160
+ Given the following brands exists:
161
+ | name |
162
+ | Alpha |
163
+ | Beta |
164
+ | Gamma |
165
+ And I go to the home page
166
+ And I fill in "Brand name" with "al"
167
+ And I choose "Alpha" in the autocomplete list
168
+ Then the "Brand name" field should contain "Alpha"
169
+
170
+ I have only tested this using Capybara, no idea if it works with something else, to see it in action, check the [example app](http://github.com/crowdint/rails3-jquery-autocomplete-app).
171
+
172
+ # Development
145
173
 
146
174
  If you want to make changes to the gem, first install bundler 1.0.0:
147
175
 
@@ -151,7 +179,7 @@ And then, install all your dependencies:
151
179
 
152
180
  bundle install
153
181
 
154
- ### Running the test suite
182
+ ## Running the test suite
155
183
 
156
184
  rake test
157
185
 
@@ -0,0 +1,5 @@
1
+ Given /^I choose "([^"]*)" in the autocomplete list$/ do |text|
2
+ page.execute_script %Q{ $('input[data-autocomplete]').trigger("keydown") }
3
+ sleep 1
4
+ page.execute_script %Q{ $('.ui-menu-item a:contains("#{text}")').trigger("mouseenter").trigger("click"); }
5
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails3-jquery-autocomplete
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Padilla
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-12 00:00:00 -07:00
18
+ date: 2010-09-14 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -46,6 +46,7 @@ extra_rdoc_files:
46
46
  files:
47
47
  - README.markdown
48
48
  - Rakefile
49
+ - lib/cucumber/autocomplete.rb
49
50
  - lib/form_helper.rb
50
51
  - lib/generators/autocomplete_generator.rb
51
52
  - lib/generators/templates/autocomplete-rails.js