No need to wait for postrender in Map test
This commit is contained in:
@@ -1070,29 +1070,24 @@ describe('ol/Map', function () {
|
|||||||
expect(spy.callCount).to.be(0);
|
expect(spy.callCount).to.be(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls renderFrame_ and results in an postrender event', function (done) {
|
it('calls renderFrame_ and results in a postrender event', function (done) {
|
||||||
const spy = sinon.spy(map, 'renderFrame_');
|
const spy = sinon.spy(map, 'renderFrame_');
|
||||||
map.render();
|
map.render();
|
||||||
map.once('postrender', function (event) {
|
map.once('postrender', function (event) {
|
||||||
expect(event).to.be.a(MapEvent);
|
expect(event).to.be.a(MapEvent);
|
||||||
expect(typeof spy.firstCall.args[0]).to.be('number');
|
expect(typeof spy.firstCall.args[0]).to.be('number');
|
||||||
spy.restore();
|
spy.restore();
|
||||||
const frameState = event.frameState;
|
expect(event.frameState).not.to.be(null);
|
||||||
expect(frameState).not.to.be(null);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the same render frame for subsequent calls', function (done) {
|
it('uses the same render frame for subsequent calls', function () {
|
||||||
map.render();
|
map.render();
|
||||||
const id1 = map.animationDelayKey_;
|
const id1 = map.animationDelayKey_;
|
||||||
let id2 = null;
|
|
||||||
map.once('postrender', function () {
|
|
||||||
expect(id2).to.be(id1);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
map.render();
|
map.render();
|
||||||
id2 = map.animationDelayKey_;
|
const id2 = map.animationDelayKey_;
|
||||||
|
expect(id1).to.be(id2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a new render frame after renderSync()', function (done) {
|
it('creates a new render frame after renderSync()', function (done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user