File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
Given /^I choose "([^"]*)" in the autocomplete list$/ do |text |
2
+ page . execute_script %Q{ $('input[data-autocomplete]').trigger("focus") }
2
3
page . execute_script %Q{ $('input[data-autocomplete]').trigger("keydown") }
3
4
sleep 1
4
5
page . execute_script %Q{ $('.ui-menu-item a:contains("#{ text } ")').trigger("mouseenter").trigger("click"); }
Original file line number Diff line number Diff line change 5
5
* with the autocomplete URL as the value
6
6
*
7
7
* Example:
8
- * <input type="text" autocomplete="/url/to/autocomplete">
8
+ * <input type="text" data- autocomplete="/url/to/autocomplete">
9
9
*
10
10
* Optionally, you can use a jQuery selector to specify a field that can
11
11
* be updated with the element id whenever you find a matching value
12
12
*
13
13
* Example:
14
- * <input type="text" autocomplete="/url/to/autocomplete" id_element="#id_field">
14
+ * <input type="text" data- autocomplete="/url/to/autocomplete" id_element="#id_field">
15
15
*/
16
16
17
17
$ ( document ) . ready ( function ( ) {
18
- $ ( 'input[data-autocomplete]' ) . each ( function ( i ) {
18
+ $ ( 'input[data-autocomplete]' ) . live ( 'focus' , function ( i ) {
19
19
$ ( this ) . autocomplete ( {
20
20
source : $ ( this ) . attr ( 'data-autocomplete' ) ,
21
21
select : function ( event , ui ) {
@@ -27,4 +27,4 @@ $(document).ready(function(){
27
27
}
28
28
} ) ;
29
29
} ) ;
30
- } ) ;
30
+ } ) ;
You can’t perform that action at this time.
0 commit comments