diff --git a/js/lib/d3.combobox.js b/js/lib/d3.combobox.js index 174d08c9c..bd8482f80 100644 --- a/js/lib/d3.combobox.js +++ b/js/lib/d3.combobox.js @@ -187,7 +187,7 @@ d3.combobox = function() { for (var i = 0; i < suggestions.length; i++) { if (suggestions[i].value.toLowerCase().indexOf(v.toLowerCase()) === 0) { - var completion = v + suggestions[i].value.substr(v.length); + var completion = suggestions[i].value; idx = i; input.property('value', completion); input.node().setSelectionRange(v.length, completion.length); diff --git a/test/spec/lib/d3.combobox.js b/test/spec/lib/d3.combobox.js index a0fa5d66c..9304f735e 100644 --- a/test/spec/lib/d3.combobox.js +++ b/test/spec/lib/d3.combobox.js @@ -132,11 +132,11 @@ describe("d3.combobox", function() { expect(input.property('selectionEnd')).to.equal(3); }); - it("preserves the case of the input portion of the value", function() { + it("does not preserve the case of the input portion of the value", function() { input.call(combobox.data(data)); input.node().focus(); simulateKeypress('B'); - expect(input.property('value')).to.equal('Bar'); + expect(input.property('value')).to.equal('bar'); expect(input.property('selectionStart')).to.equal(1); expect(input.property('selectionEnd')).to.equal(3); });