Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Unit Test for "mouseEventToLayerPoint" #9222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions spec/suites/map/MapSpec.js
Expand Up @@ -2611,4 +2611,30 @@
map.flyToBounds(bounds, {animate: false});
});
});
describe('#mouseEventToLayerPoint', function () {

Check failure on line 2614 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected function expression
var map, container;

Check failure on line 2615 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead
beforeEach(function () {

Check failure on line 2616 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected function expression
container = document.createElement('div');
container.style.width = '400px';
container.style.height = '400px';
document.body.appendChild(container);
map = L.map(container).setView([0, 0], 1);

Check failure on line 2621 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

'L' is not defined
});

Check failure on line 2623 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
afterEach(function () {

Check failure on line 2624 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected function expression
document.body.removeChild(container);
});

Check failure on line 2627 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
it('converts a mouse event to the correct layer point', function () {

Check failure on line 2628 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected function expression
// Create a fake mouse event at a specific position
var fakeMouseEvent = new MouseEvent('click', {

Check failure on line 2630 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead
clientX: 100,
clientY: 100
});
container.dispatchEvent(fakeMouseEvent);
var layerPoint = map.mouseEventToLayerPoint(fakeMouseEvent);

Check failure on line 2635 in spec/suites/map/MapSpec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead
var expectedPoint = map.containerPointToLayerPoint(map.mouseEventToContainerPoint(fakeMouseEvent));
expect(layerPoint).to.eql(expectedPoint);
});
});
});