Test empty string rendering for mouse control
This commit is contained in:
@@ -105,9 +105,9 @@ describe('ol/control/MousePosition', function () {
|
|||||||
expect(element.innerHTML).to.be(' ');
|
expect(element.innerHTML).to.be(' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('retains the mouse position when undefinedHTML is falsey and mouse moves outside the viewport', function () {
|
it('retains the mouse position when undefinedHTML is false and mouse moves outside the viewport', function () {
|
||||||
const ctrl = new MousePosition({
|
const ctrl = new MousePosition({
|
||||||
undefinedHTML: '',
|
undefinedHTML: false,
|
||||||
});
|
});
|
||||||
ctrl.setMap(map);
|
ctrl.setMap(map);
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
@@ -127,6 +127,29 @@ describe('ol/control/MousePosition', function () {
|
|||||||
simulateEvent(EventType.POINTEROUT, width + 1, height + 1);
|
simulateEvent(EventType.POINTEROUT, width + 1, height + 1);
|
||||||
expect(element.innerHTML).to.be('20,-30');
|
expect(element.innerHTML).to.be('20,-30');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders an empty string if undefinedHTML is an empty string and mouse moves outside the viewport', function () {
|
||||||
|
const ctrl = new MousePosition({
|
||||||
|
undefinedHTML: '',
|
||||||
|
});
|
||||||
|
ctrl.setMap(map);
|
||||||
|
map.renderSync();
|
||||||
|
|
||||||
|
const element = document.querySelector(
|
||||||
|
'.ol-mouse-position',
|
||||||
|
map.getTarget()
|
||||||
|
);
|
||||||
|
|
||||||
|
simulateEvent(EventType.POINTEROUT, width + 1, height + 1);
|
||||||
|
expect(element.innerHTML).to.be('');
|
||||||
|
|
||||||
|
target.dispatchEvent(new PointerEvent('pointermove'));
|
||||||
|
simulateEvent(EventType.POINTERMOVE, 20, 30);
|
||||||
|
expect(element.innerHTML).to.be('20,-30');
|
||||||
|
|
||||||
|
simulateEvent(EventType.POINTEROUT, width + 1, height + 1);
|
||||||
|
expect(element.innerHTML).to.be('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user