mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-07 11:51:35 +00:00
Fix code tests
This commit is contained in:
@@ -94,7 +94,7 @@ export function behaviorHover(context) {
|
||||
|
||||
function pointerover() {
|
||||
// ignore mouse hovers with buttons pressed unless dragging
|
||||
if (!context.mode().id.includes('drag') &&
|
||||
if (context.mode().id.indexOf('drag') === -1 &&
|
||||
(!d3_event.pointerType || d3_event.pointerType === 'mouse') &&
|
||||
d3_event.buttons) return;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('iD.behaviorHover', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('mouseover', function () {
|
||||
describe('mouseover and mouseout', function () {
|
||||
it('adds the .hover class to all elements to which the same datum is bound', function () {
|
||||
var a = iD.osmNode({id: 'a'});
|
||||
var b = iD.osmNode({id: 'b'});
|
||||
@@ -45,6 +45,9 @@ describe('iD.behaviorHover', function() {
|
||||
|
||||
expect(_container.selectAll('.a.hover').nodes()).to.have.length(2);
|
||||
expect(_container.selectAll('.b.hover').nodes()).to.have.length(0);
|
||||
|
||||
iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseout');
|
||||
expect(_container.selectAll('.hover').nodes()).to.have.length(0);
|
||||
});
|
||||
|
||||
it('adds the .hover class to all members of a relation', function() {
|
||||
@@ -61,16 +64,8 @@ describe('iD.behaviorHover', function() {
|
||||
|
||||
expect(_container.selectAll('.a.hover').nodes()).to.have.length(1);
|
||||
expect(_container.selectAll('.b.hover').nodes()).to.have.length(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('mouseout', function () {
|
||||
it('removes the .hover class from all elements', function () {
|
||||
_container.append('span').attr('class', 'hover');
|
||||
|
||||
_container.call(iD.behaviorHover(_context));
|
||||
iD.utilTriggerEvent(_container.selectAll('.hover'), 'mouseout');
|
||||
|
||||
iD.utilTriggerEvent(_container.selectAll('.a'), 'mouseout');
|
||||
expect(_container.selectAll('.hover').nodes()).to.have.length(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user