Skip to content

Commit

Permalink
add unit test to check that getBounds returns the inset with padding
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Feb 17, 2021
1 parent e4b25b8 commit 27be9e1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unit/ui/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,24 @@ test('Map', (t) => {
t.end();
});

t.test('padded bounds', (t) => {
const map = createMap(t, {zoom: 1, bearing: 45, skipCSSStub: true, skipAuthenticateStub: true});

map.setPadding({
left: 100,
right: 10,
top: 10,
bottom: 10
});

t.deepEqual(
toFixed([[-33.5599507477, -31.7907658998], [33.5599507477, 31.7907658998]]),
toFixed(map.getBounds().toArray())
);

t.end();
});

t.end();

function toFixed(bounds) {
Expand Down

0 comments on commit 27be9e1

Please sign in to comment.