Merge branch 'master' of github.com:systemed/iD

This commit is contained in:
Saman Bemel-Benrud
2013-02-19 15:03:05 -05:00
3 changed files with 24 additions and 4 deletions
+2 -1
View File
@@ -182,7 +182,8 @@ iD.ui.Taglist = function() {
function pushMore() {
if (d3.event.keyCode === 9 &&
list.selectAll('li:last-child input.value').node() === this) {
list.selectAll('li:last-child input.value').node() === this &&
!d3.event.shiftKey) {
addTag();
focusNewKey();
d3.event.preventDefault();
+5 -3
View File
@@ -137,7 +137,7 @@ d3.combobox = function() {
var prevValue, prevCompletion;
function autocomplete() {
function autocomplete(e, data) {
var value = input.property('value'),
match;
@@ -150,7 +150,7 @@ d3.combobox = function() {
}
// backspace
if (d3.event.keyCode === 8) {
if (e.keyCode === 8) {
prevValue = value;
prevCompletion = '';
@@ -183,12 +183,14 @@ d3.combobox = function() {
value = input.property('value');
}
var e = d3.event;
function render(data) {
if (data.length) show();
else hide();
autocomplete();
autocomplete(e, data);
updateSize();
+17
View File
@@ -75,4 +75,21 @@ describe("iD.ui.Inspector", function () {
expect(spy).to.have.been.calledWith(entity, tags);
});
it("adds tags when pressing the TAB key on last input.value", function () {
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
var input = d3.select('.tag-list li:last-child input.value')[0][0];
happen.keydown(d3.select(input).node(), {keyCode: 9});
expect(element.selectAll('.tag-list li')[0].length).to.eql(2);
expect(element.select('.tag-list').selectAll("input")[0][2].value).to.be.empty;
expect(element.select('.tag-list').selectAll("input")[0][3].value).to.be.empty;
});
it("does not add a tag when pressing TAB while shift is pressed", function () {
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
var input = d3.select('.tag-list li:last-child input.value')[0][0];
happen.keydown(d3.select(input).node(), {keyCode: 9, shiftKey: true});
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
});
});