Skip to content

Commit

Permalink
add unit test for opening popup on Space
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Jul 21, 2019
1 parent 285e14e commit 07b826b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/unit/ui/marker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,25 @@ test('Enter key on Marker opens a popup that was closed', (t) => {
t.end();
});

test('Space key on Marker opens a popup that was closed', (t) => {
const map = createMap(t);
const marker = new Marker()
.setLngLat([0, 0])
.addTo(map)
.setPopup(new Popup())

// popup not initially open
t.notOk(marker.getPopup().isOpen());

simulate.keypress(marker.getElement(), { code: 'Space' });

// popup open after Enter keypress
t.ok(marker.getPopup().isOpen());

map.remove();
t.end();
});

test('Marker anchor defaults to center', (t) => {
const map = createMap(t);
const marker = new Marker()
Expand Down

0 comments on commit 07b826b

Please sign in to comment.