diff --git a/js/lib/d3.combobox.js b/js/lib/d3.combobox.js index 41355ceec..db9ccae21 100644 --- a/js/lib/d3.combobox.js +++ b/js/lib/d3.combobox.js @@ -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) { diff --git a/test/spec/lib/d3.combobox.js b/test/spec/lib/d3.combobox.js index c39d1f89f..0047a2cc2 100644 --- a/test/spec/lib/d3.combobox.js +++ b/test/spec/lib/d3.combobox.js @@ -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');