mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Fix and simplify hover test
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user