mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Prefer suggested capitalization over user value in combobox (closes #2791)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user