Merge pull request #6675 from tchandelle/translate-cursor
Reset cursor when translate interaction is removed or deactivated
This commit is contained in:
@@ -224,11 +224,67 @@ describe('ol.interaction.Translate', function() {
|
||||
|
||||
simulateEvent('pointerup', 10, 20);
|
||||
expect(element.style.cursor).to.match(/grab$/);
|
||||
|
||||
simulateEvent('pointermove', 0, 0);
|
||||
expect(element.style.cursor).to.eql('');
|
||||
});
|
||||
|
||||
it('respects existing cursor value', function() {
|
||||
element.style.cursor = 'pointer';
|
||||
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
expect(element.style.cursor).to.match(/grab$/);
|
||||
|
||||
simulateEvent('pointerdown', 10, 20);
|
||||
expect(element.style.cursor).to.match(/grabbing$/);
|
||||
|
||||
simulateEvent('pointerup', 10, 20);
|
||||
expect(element.style.cursor).to.match(/grab$/);
|
||||
|
||||
simulateEvent('pointermove', 0, 0);
|
||||
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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user