Skip to content

Commit

Permalink
add more Tile redoPlacement tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jan 18, 2017
1 parent 5763249 commit 054d296
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions test/js/source/tile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,45 @@ test('querySourceFeatures', (t) => {
t.end();
});

test('Tile#redoPlacement on an empty tile', (t) => {
const tile = new Tile(new TileCoord(1, 1, 1));
tile.loadVectorData(null, createPainter());
test('Tile#redoPlacement', (t) => {

test('redoPlacement on an empty tile', (t) => {
const tile = new Tile(new TileCoord(1, 1, 1));
tile.loadVectorData(null, createPainter());

t.doesNotThrow(() => tile.redoPlacement({type: 'vector'}));
t.notOk(tile.redoWhenDone);
t.end();
});

test('redoPlacement on a loading tile', (t) => {
const tile = new Tile(new TileCoord(1, 1, 1));
t.doesNotThrow(() => tile.redoPlacement({type: 'vector'}));
t.ok(tile.redoWhenDone);
t.end();
});

test('redoPlacement on a reloading tile', (t) => {
const tile = new Tile(new TileCoord(1, 1, 1));
tile.loadVectorData(createVectorData(), createPainter());

const options = {
type: 'vector',
dispatcher: {
send: () => {}
},
map: {
transform: {}
}
};

tile.redoPlacement(options);
tile.redoPlacement(options);

t.ok(tile.redoWhenDone);
t.end();
});

t.doesNotThrow(() => tile.redoPlacement({type: 'vector'}));
t.end();
});

Expand Down

0 comments on commit 054d296

Please sign in to comment.