Fix assumption that [0] contains the nodes

This commit is contained in:
Tom MacWright
2016-09-04 18:19:02 -04:00
parent 760c515c8a
commit e659bd75e9
2 changed files with 14 additions and 14 deletions

View File

@@ -30,10 +30,10 @@ describe('iD.behavior.Hover', function() {
.enter().append('span').attr('class', function(d) { return d.id; });
container.call(iD.behavior.Hover(context));
iD.util.triggerEvent(container.selectAll('.a'), 'mouseover');
container.dispatch('mouseover', {hi: true});
expect(container.selectAll('.a.hover')[0]).to.have.length(2);
expect(container.selectAll('.b.hover')[0]).to.have.length(0);
expect(container.selectAll('.a.hover').nodes()).to.have.length(2);
expect(container.selectAll('.b.hover').nodes()).to.have.length(0);
});
it('adds the .hover class to all members of a relation', function() {
@@ -42,10 +42,10 @@ describe('iD.behavior.Hover', function() {
.enter().append('span').attr('class', function(d) { return d.id; });
container.call(iD.behavior.Hover(context));
iD.util.triggerEvent(container.selectAll('.a'), 'mouseover');
container.selectAll('.a').dispatch('mouseover');
expect(container.selectAll('.a.hover')[0]).to.have.length(1);
expect(container.selectAll('.b.hover')[0]).to.have.length(1);
expect(container.selectAll('.a.hover').nodes()).to.have.length(1);
expect(container.selectAll('.b.hover').nodes()).to.have.length(1);
});
});
@@ -54,9 +54,9 @@ describe('iD.behavior.Hover', function() {
container.append('span').attr('class', 'hover');
container.call(iD.behavior.Hover(context));
iD.util.triggerEvent(container.selectAll('.hover'), 'mouseout');
container.selectAll('.hover').dispatch('mouseout');
expect(container.selectAll('.hover')[0]).to.have.length(0);
expect(container.selectAll('.hover').nodes()).to.have.length(0);
});
});
@@ -67,8 +67,8 @@ describe('iD.behavior.Hover', function() {
container.call(iD.behavior.Hover(context).altDisables(true));
happen.keydown(window, {keyCode: 18});
expect(container.selectAll('.hover')[0]).to.have.length(0);
expect(container.selectAll('.hover-suppressed')[0]).to.have.length(1);
expect(container.selectAll('.hover').nodes()).to.have.length(0);
expect(container.selectAll('.hover-suppressed').nodes()).to.have.length(1);
});
});
@@ -79,8 +79,8 @@ describe('iD.behavior.Hover', function() {
container.call(iD.behavior.Hover(context).altDisables(true));
happen.keyup(window, {keyCode: 18});
expect(container.selectAll('.hover')[0]).to.have.length(1);
expect(container.selectAll('.hover-suppressed')[0]).to.have.length(0);
expect(container.selectAll('.hover').nodes()).to.have.length(1);
expect(container.selectAll('.hover-suppressed').nodes()).to.have.length(0);
});
});
});

View File

@@ -39,8 +39,8 @@ describe('iD.ui.RawTagEditor', function() {
it('adds tags when clicking the add button', function (done) {
iD.util.triggerEvent(element.selectAll('button.add-tag'), 'click');
setTimeout(function() {
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;
expect(element.select('.tag-list').selectAll('input').nodes()[2].value).to.be.empty;
expect(element.select('.tag-list').selectAll('input').nodes()[3].value).to.be.empty;
done();
}, 20);
});