}
});
-var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
+var data = [ "Clojure", "COBOL", "ColdFusion", "Java", "JavaScript", "Scala", "Scheme" ];
test("all events", function() {
- expect(12);
+ expect(14);
var ac = $("#autocomplete").autocomplete({
autoFocus: false,
delay: 0,
search: function(event) {
same(event.type, "autocompletesearch");
},
+ response: function(event, ui) {
+ same(event.type, "autocompleteresponse");
+ same(ui.content, [
+ { label: "Clojure", value: "Clojure" },
+ { label: "Java", value: "Java" },
+ { label: "JavaScript", value: "JavaScript" }
+ ]);
+ ui.content.splice( 0, 1 );
+ },
open: function(event) {
same(event.type, "autocompleteopen");
},
focus: function(event, ui) {
same(event.type, "autocompletefocus");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
},
close: function(event) {
same(event.type, "autocompleteclose");
},
select: function(event, ui) {
same(event.type, "autocompleteselect");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
},
change: function(event, ui) {
same(event.type, "autocompletechange");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
same( $(".ui-menu:visible").length, 0 );
start();
}
});
stop();
- ac.focus().val("ja").keydown();
+ ac.focus().val("j").keydown();
setTimeout(function() {
same( $(".ui-menu:visible").length, 1 );
ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN });
});
test("all events - contenteditable", function() {
- expect(12);
+ expect(14);
var ac = $("#autocomplete-contenteditable").autocomplete({
autoFocus: false,
delay: 0,
search: function(event) {
same(event.type, "autocompletesearch");
},
+ response: function(event, ui) {
+ same(event.type, "autocompleteresponse");
+ same(ui.content, [
+ { label: "Clojure", value: "Clojure" },
+ { label: "Java", value: "Java" },
+ { label: "JavaScript", value: "JavaScript" }
+ ]);
+ ui.content.splice( 0, 1 );
+ },
open: function(event) {
same(event.type, "autocompleteopen");
},
focus: function(event, ui) {
same(event.type, "autocompletefocus");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
},
close: function(event) {
same(event.type, "autocompleteclose");
},
select: function(event, ui) {
same(event.type, "autocompleteselect");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
},
change: function(event, ui) {
same(event.type, "autocompletechange");
- same(ui.item, {label:"java", value:"java"});
+ same(ui.item, {label:"Java", value:"Java"});
same( $(".ui-menu:visible").length, 0 );
start();
}
});
stop();
- ac.focus().text("ja").keydown();
+ ac.focus().text("j").keydown();
setTimeout(function() {
same( $(".ui-menu:visible").length, 1 );
ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN });