-
-
Notifications
You must be signed in to change notification settings - Fork 768
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
[Jest] Migrate popup.test.js
#687
Conversation
Tests that do things like |
Bundle size report: Size Change: 0 B
ℹ️ View DetailsNo major changes |
Is jest-dom (https://www.npmjs.com/package/@testing-library/jest-dom) what we want to use here? |
No, but the element has to be added to The following works: test('Popup with disabled focusing does not change the active element', () => {
const dummyFocusedEl = window.document.createElement('button');
window.document.body.appendChild(dummyFocusedEl);
dummyFocusedEl.focus();
new Popup({closeButton: false, focusAfterOpen: false})
.setHTML('<span tabindex="0" data-testid="abc">Test</span>')
.setLngLat([0, 0])
.addTo(createMap());
expect(window.document.activeElement).toBe(dummyFocusedEl);
}); |
src/ui/popup.test.ts
Outdated
@@ -0,0 +1,739 @@ | |||
import {createMap as globalCreateMap, setPerformance, setWebGlContext} from '../util/test/util'; | |||
import Popup, {Offset} from '../ui/popup'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: shorter path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the path and you are good to go :-)
Thanks for reviewing @HarelM! |
* main: (98 commits) [Jest] Migrate `geojson_worker_source.test.js` (maplibre#731) Fix events being fired after Map#remove has been called when the WebGL context is lost and restored (maplibre#726) (maplibre#727) Define return type of getSource as possibly undefined (maplibre#724) Fix attibution controll (maplibre#668) Fix start-debug to watch ts files (maplibre#704) [Jest] Migrate `touch_zoom_rotate.test.js` (maplibre#721) [Jest] Migrate `requestRenderFrame.test.js` (maplibre#722) [Jest] Migrate `scroll_zoom.test.js` (maplibre#712) [Jest] Migrate `marker.test.js` (maplibre#696) [Jest] Migrate `mouse_rotate.test.js` (maplibre#711) [Jest] Migrate `keyboard.test.js` (maplibre#707) [Jest] Migrate `map_event.test.js` (maplibre#710) [Jest] Migrate `drag_rotate.test.js` (maplibre#709) Handle spies and call counts (maplibre#708) [Jest] Migrate `drag_pan.test.js` (maplibre#702) Add type for styleimagemissing event (maplibre#703) Fix MapDataEvent#isSourceLoaded being true in GeoJSONSource "dataloading" event handlers (maplibre#694) (maplibre#695) [Jest] Migrate `dblclick_zoom.test.js` (maplibre#697) [Jest] Migrate `popup.test.js` (maplibre#687) Fixed typo (maplibre#698) ...
Launch Checklist
maplibre-gl-js
changelog:<changelog></changelog>
.