mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
@@ -211,6 +211,9 @@ export function d3combobox() {
|
||||
idx = -1;
|
||||
if (!v) return;
|
||||
|
||||
// Don't autocomplete if user is typing a number - #4935
|
||||
if (!isNaN(parseFloat(v)) && isFinite(v)) return;
|
||||
|
||||
var best = -1;
|
||||
var suggestion, compare;
|
||||
|
||||
|
||||
@@ -160,6 +160,18 @@ describe('d3.combobox', function() {
|
||||
expect(body.selectAll('.combobox-option.selected').text()).to.equal('foo'); // skip foobar
|
||||
});
|
||||
|
||||
it('does not autocomplete numeric options', function() {
|
||||
var numeric = [
|
||||
{title: '100', value: '100'},
|
||||
{title: '110', value: '110'}
|
||||
];
|
||||
input.call(combobox.data(numeric));
|
||||
focusTypeahead(input);
|
||||
simulateKeypress('1');
|
||||
simulateKeypress('0');
|
||||
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
|
||||
});
|
||||
|
||||
it('selects the completed portion of the value', function() {
|
||||
input.call(combobox.data(data));
|
||||
focusTypeahead(input);
|
||||
|
||||
Reference in New Issue
Block a user