Merge pull request #10027 from tschaub/fix-test
Confirm zoomByDelta calls view.animate()
This commit is contained in:
@@ -93,20 +93,20 @@ describe('zoomByDelta - useGeographic', () => {
|
|||||||
beforeEach(useGeographic);
|
beforeEach(useGeographic);
|
||||||
afterEach(clearUserProjection);
|
afterEach(clearUserProjection);
|
||||||
|
|
||||||
it('works with a user projection set', done => {
|
it('works with a user projection set', () => {
|
||||||
const view = new View({
|
const view = new View({
|
||||||
center: [0, 0],
|
center: [0, 0],
|
||||||
zoom: 0
|
zoom: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const spy = sinon.spy(view, 'animate');
|
||||||
|
|
||||||
const anchor = [90, 45];
|
const anchor = [90, 45];
|
||||||
const duration = 10;
|
const duration = 10;
|
||||||
zoomByDelta(view, 1, anchor, duration);
|
zoomByDelta(view, 1, anchor, duration);
|
||||||
setTimeout(() => {
|
|
||||||
const center = view.getCenter();
|
expect(spy.callCount).to.be(1);
|
||||||
expect(center[0]).to.be(45);
|
const options = spy.getCall(0).args[0];
|
||||||
expect(center[1]).to.roughlyEqual(24.4698, 1e-4);
|
expect(options.anchor).to.be(anchor);
|
||||||
done();
|
|
||||||
}, 2 * duration);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user