Skip to content

Commit 35f5104

Browse files
fix vdieolayer ut
1 parent 35e5063 commit 35f5104

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

test/mapboxgl/overlay/VideoLayerSpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ describe('mapboxgl_VideoLayer', () => {
8181
testDiv.style.height = '500px';
8282
window.document.body.appendChild(testDiv);
8383
spyOn(mapboxgl, 'Map').and.callFake(mbglmap);
84+
done();
85+
});
86+
beforeEach((done) => {
8487
map = new mapboxgl.Map({
8588
container: 'map',
8689
style: {
@@ -108,13 +111,12 @@ describe('mapboxgl_VideoLayer', () => {
108111
map.on('load', function () {
109112
done();
110113
});
111-
});
112-
beforeEach(() => {
113114
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
114115
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
115116
});
116117

117118
afterEach(() => {
119+
map = null;
118120
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
119121
});
120122

@@ -293,8 +295,7 @@ describe('mapboxgl_VideoLayer', () => {
293295
}, 3000);
294296
});
295297

296-
it('multi videoparameter load with time', function(done) {
297-
spyOn(map, 'addSource');
298+
it('multi videoparameter load with time', (done) => {
298299
spyOn(map, 'addLayer');
299300
const videoLayer = new VideoLayer({
300301
opencv: cv,
@@ -381,7 +382,6 @@ describe('mapboxgl_VideoLayer', () => {
381382
videoLayer.onAdd(map);
382383
setTimeout(() => {
383384
expect(Object.keys(videoLayer.timeParams).length).toBe(4);
384-
expect(map.addSource).toHaveBeenCalled();
385385
expect(map.addLayer).toHaveBeenCalled();
386386
done();
387387
}, 3000);

test/tool/mock_mapboxgl_map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const Map = function (options) {
166166
const sourceInfo = this._sources[name];
167167
if (sourceInfo && sourceInfo.type === 'video') {
168168
return {
169+
setCoordinates: function () {},
169170
play: function () {}
170171
};
171172
}

0 commit comments

Comments
 (0)