Reset cursor when translate interaction is removed or deactivated

This commit is contained in:
Thomas Chandelle
2017-04-06 12:04:16 +02:00
parent e7f91cd526
commit 5c23123b6d
2 changed files with 87 additions and 0 deletions

View File

@@ -233,6 +233,50 @@ describe('ol.interaction.Translate', function() {
expect(element.style.cursor).to.eql('pointer');
});
it('resets css cursor when interaction is deactivated while pointer is on feature', function() {
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
translate.setActive(false);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('');
});
it('resets css cursor to existing cursor when interaction is deactivated while pointer is on feature', function() {
element.style.cursor = 'pointer';
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
translate.setActive(false);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('pointer');
});
it('resets css cursor interaction is removed while pointer is on feature', function() {
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
map.removeInteraction(translate);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('');
});
it('resets css cursor to existing cursor interaction is removed while pointer is on feature', function() {
element.style.cursor = 'pointer';
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
map.removeInteraction(translate);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('pointer');
});
});
});