Fix combobox autocomplete behavior for taginfo

This commit is contained in:
John Firebaugh
2013-06-21 19:51:44 -07:00
parent aecb07a41a
commit f3a089d837
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -177,10 +177,9 @@ d3.combobox = function() {
function autocomplete() {
var v = value();
if (!v) {
idx = -1;
return;
}
idx = -1;
if (!v) return;
for (var i = 0; i < suggestions.length; i++) {
if (suggestions[i].value.toLowerCase().indexOf(v.toLowerCase()) === 0) {
+1 -1
View File
@@ -133,7 +133,7 @@ describe("d3.combobox", function() {
});
it("does not select when value is not a prefix of any suggestion", function() {
input.call(combobox.data(data));
input.call(combobox.fetcher(function(_, cb) { cb(data); }));
input.node().focus();
simulateKeypress('c');
simulateKeypress('a');