From e134cd7ffd3fa343abd3b28c2eb33f07cfd25e43 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:58:33 -0400 Subject: [PATCH] Fix and simplify hover test --- test/spec/behavior/hover.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/spec/behavior/hover.js b/test/spec/behavior/hover.js index 75f506d27..6cf743dbe 100644 --- a/test/spec/behavior/hover.js +++ b/test/spec/behavior/hover.js @@ -41,13 +41,13 @@ describe('iD.behaviorHover', function() { .enter().append('span').attr('class', function(d) { return d.id; }); _container.call(iD.behaviorHover(_context)); - iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseover'); + iD.utilTriggerEvent(_container.select('.a'), 'mouseover'); - expect(_container.selectAll('.a.hover').nodes()).to.have.length(2); - expect(_container.selectAll('.b.hover').nodes()).to.have.length(0); + expect(_container.selectAll('.a.hover').size()).to.eql(2); + expect(_container.selectAll('.b.hover').size()).to.eql(0); - iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseout'); - expect(_container.selectAll('.hover').nodes()).to.have.length(0); + iD.utilTriggerEvent(_container.select('.a'), 'mouseout'); + expect(_container.selectAll('.hover').size()).to.eql(0); }); it('adds the .hover class to all members of a relation', function() { @@ -62,11 +62,11 @@ describe('iD.behaviorHover', function() { _container.call(iD.behaviorHover(_context)); iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseover'); - expect(_container.selectAll('.a.hover').nodes()).to.have.length(1); - expect(_container.selectAll('.b.hover').nodes()).to.have.length(1); + expect(_container.selectAll('.a.hover').size()).to.eql(1); + expect(_container.selectAll('.b.hover').size()).to.eql(1); iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseout'); - expect(_container.selectAll('.hover').nodes()).to.have.length(0); + expect(_container.selectAll('.hover').size()).to.eql(0); }); }); @@ -76,8 +76,8 @@ describe('iD.behaviorHover', function() { _container.call(iD.behaviorHover(_context).altDisables(true)); happen.keydown(window, { keyCode: 18 }); - expect(_container.selectAll('.hover').nodes()).to.have.length(0); - expect(_container.selectAll('.hover-suppressed').nodes()).to.have.length(1); + expect(_container.selectAll('.hover').size()).to.eql(0); + expect(_container.selectAll('.hover-suppressed').size()).to.eql(1); happen.keyup(window, { keyCode: 18 }); }); @@ -97,8 +97,8 @@ describe('iD.behaviorHover', function() { happen.keydown(window, { keyCode: 18 }); happen.keyup(window, { keyCode: 18 }); - expect(_container.selectAll('.hover').nodes()).to.have.length(1); - expect(_container.selectAll('.hover-suppressed').nodes()).to.have.length(0); + expect(_container.selectAll('.hover').size()).to.eql(1); + expect(_container.selectAll('.hover-suppressed').size()).to.eql(0); }); it('removes the .hover-disabled class from the surface', function () {