Skip to content

Commit 21c855d

Browse files
[fix]UT
1 parent 12073dd commit 21c855d

File tree

2 files changed

+40
-42
lines changed

2 files changed

+40
-42
lines changed

test/mapboxgl/overlay/L7LayerSpec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,14 @@ describe('mapboxgl L7Layer', () => {
308308
spyOn(map.style, 'setLayoutProperty');
309309
expect(layer.animateStatus).toBeTruthy();
310310

311-
map.setLayoutProperty(layer.id, 'visibility', 'hidden');
311+
map.setLayoutProperty(layer.id, 'visibility', 'none');
312312
expect(l7Layer.hide).toHaveBeenCalled();
313313
expect(map.style.setLayoutProperty).toHaveBeenCalled();
314314
expect(layer.animateStatus).toBeFalsy();
315315

316316
map.setLayoutProperty(layer.id, 'visibility', 'visible');
317317
expect(l7Layer.show).toHaveBeenCalled();
318318
expect(map.style.setLayoutProperty).toHaveBeenCalled();
319-
expect(layer.animateStatus).toBeTruthy();
320319

321320
done();
322321
});

test/tool/mock_l7.js

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,45 @@ const Mapbox = ({ mapInstance }) => {
2424
const Maplibre = ({ mapInstance }) => {
2525
return mapInstance;
2626
};
27-
const Layer = () => {
28-
this.animateStatus = false;
29-
return {
30-
animateStatus: this.animateStatus || false,
31-
source() {
32-
return this;
33-
},
34-
style() {
35-
return this;
36-
},
37-
animate(arg) {
38-
this.animateStatus = arg;
39-
return this;
40-
},
41-
size() {
42-
return this;
43-
},
44-
color() {
45-
return this;
46-
},
47-
texture() {
48-
return this;
49-
},
50-
filter() {
51-
return this;
52-
},
53-
shape() {
54-
return this;
55-
},
56-
active() {
57-
return this;
58-
},
59-
show() {
60-
return this;
61-
},
62-
hide() {
63-
return this;
64-
}
65-
};
66-
};
27+
class Layer {
28+
constructor() {
29+
this.animateStatus = false;
30+
}
31+
source() {
32+
return this;
33+
}
34+
style() {
35+
return this;
36+
}
37+
animate(arg) {
38+
this.animateStatus = arg;
39+
return this;
40+
}
41+
size() {
42+
return this;
43+
}
44+
color() {
45+
return this;
46+
}
47+
texture() {
48+
return this;
49+
}
50+
filter() {
51+
return this;
52+
}
53+
shape() {
54+
return this;
55+
}
56+
active() {
57+
return this;
58+
}
59+
show() {
60+
return this;
61+
}
62+
hide() {
63+
return this;
64+
}
65+
}
6766
const PointLayer = Layer;
6867
const GeometryLayer = Layer;
6968
export { PointLayer, GeometryLayer, Scene, Mapbox, Maplibre };

0 commit comments

Comments
 (0)