mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix tab behavior in tag list
This commit is contained in:
@@ -99,7 +99,7 @@ d3.combobox = function() {
|
||||
break;
|
||||
// tab
|
||||
case 9:
|
||||
container.selectAll('a.selected').trigger('click');
|
||||
container.selectAll('a.selected').each(event.accept);
|
||||
break;
|
||||
// return
|
||||
case 13:
|
||||
@@ -127,7 +127,8 @@ d3.combobox = function() {
|
||||
break;
|
||||
// return
|
||||
case 13:
|
||||
container.selectAll('a.selected').trigger('click');
|
||||
container.selectAll('a.selected').each(event.accept);
|
||||
hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ describe("d3.combobox", function() {
|
||||
|
||||
case '↑':
|
||||
case '↓':
|
||||
case '↩':
|
||||
break;
|
||||
|
||||
case '⌫':
|
||||
@@ -117,14 +118,6 @@ describe("d3.combobox", function() {
|
||||
expect(input.property('selectionEnd')).to.equal(8);
|
||||
});
|
||||
|
||||
it("does not select on ⇥", function() {
|
||||
input.call(combobox.data(data));
|
||||
input.node().focus();
|
||||
simulateKeypress('c');
|
||||
simulateKeypress('⇥');
|
||||
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
|
||||
});
|
||||
|
||||
it("does not select when value is empty", function() {
|
||||
input.call(combobox.data(data));
|
||||
input.node().focus();
|
||||
@@ -180,4 +173,33 @@ describe("d3.combobox", function() {
|
||||
expect(body.selectAll('.combobox-option.selected').text()).to.equal('abbot');
|
||||
expect(input.property('value')).to.equal('abbot');
|
||||
});
|
||||
|
||||
it("emits accepted event with selected datum on ⇥", function(done) {
|
||||
combobox.on('accept', function(d) {
|
||||
expect(d).to.eql({title: 'abbot', value: 'abbot'});
|
||||
done();
|
||||
});
|
||||
input.call(combobox.data(data));
|
||||
input.node().focus();
|
||||
simulateKeypress('a');
|
||||
simulateKeypress('⇥');
|
||||
});
|
||||
|
||||
it("emits accepted event with selected datum on ↩", function(done) {
|
||||
combobox.on('accept', function(d) {
|
||||
expect(d).to.eql({title: 'abbot', value: 'abbot'});
|
||||
done();
|
||||
});
|
||||
input.call(combobox.data(data));
|
||||
input.node().focus();
|
||||
simulateKeypress('a');
|
||||
simulateKeypress('↩');
|
||||
});
|
||||
|
||||
it("hides on ↩", function() {
|
||||
input.call(combobox.data(data));
|
||||
input.node().focus();
|
||||
simulateKeypress('↩');
|
||||
expect(body.selectAll('.combobox').size()).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user