mirror of https://gitee.com/antv-l7/antv-l7
chore: 增加覆盖率Ci (#1323)
* chore: 增加覆盖率Ci * chore: jest locv * fix: layer 单测样例
This commit is contained in:
parent
2fe8423939
commit
58df737121
|
@ -16,4 +16,8 @@ jobs:
|
|||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn
|
||||
- run: yarn run worker
|
||||
- run: yarn test-cover
|
||||
- run: yarn test-cover
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -87,3 +87,4 @@ packages/district/src/data
|
|||
.umi-production/
|
||||
.umi/
|
||||
docs-dist
|
||||
/packages/leaflet
|
||||
|
|
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
},
|
||||
setupFilesAfterEnv: [ '<rootDir>jest/setupTests.ts' ],
|
||||
snapshotSerializers: [ 'enzyme-to-json/serializer' ],
|
||||
coverageReporters: ["html"],
|
||||
coverageReporters: ['html', 'lcov', 'clover'],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 9,
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
// @ts-ignore
|
||||
import { TestScene } from '@antv/l7-test-utils';
|
||||
import PointLayer from '../';
|
||||
|
||||
describe('template', () => {
|
||||
const el = document.createElement('div');
|
||||
el.id = 'test-div-id';
|
||||
const body = document.querySelector('body') as HTMLBodyElement;
|
||||
body.appendChild(el);
|
||||
const scene = TestScene({});
|
||||
const testData = [
|
||||
{
|
||||
x: 112,
|
||||
y: 30,
|
||||
name:'text1',
|
||||
v:10,
|
||||
},
|
||||
{
|
||||
x: 112,
|
||||
y: 32,
|
||||
name:'text2',
|
||||
v:20
|
||||
},
|
||||
];
|
||||
|
||||
it('scene layer fill', async () => {
|
||||
const layer = new PointLayer().source(
|
||||
testData,
|
||||
{
|
||||
parser: {
|
||||
type: 'json',
|
||||
x: 'x',
|
||||
y: 'y',
|
||||
},
|
||||
},
|
||||
).shape('circle')
|
||||
.color('red')
|
||||
.size(10)
|
||||
scene.addLayer(layer)
|
||||
|
||||
});
|
||||
it('scene layer text', async () => {
|
||||
const layer = new PointLayer({name:'text'}).source(
|
||||
testData,
|
||||
{
|
||||
parser: {
|
||||
type: 'json',
|
||||
x: 'x',
|
||||
y: 'y',
|
||||
},
|
||||
},
|
||||
).shape('name','text')
|
||||
.color('name',['red','blue'])
|
||||
.size('v',[10,20])
|
||||
scene.addLayer(layer)
|
||||
expect(layer.name).toEqual('text')
|
||||
|
||||
});
|
||||
|
||||
it('scene layer extrude', async () => {
|
||||
const layer = new PointLayer().source(
|
||||
testData,
|
||||
{
|
||||
parser: {
|
||||
type: 'json',
|
||||
x: 'x',
|
||||
y: 'y',
|
||||
},
|
||||
},
|
||||
).shape('cloumn')
|
||||
.color('red')
|
||||
.size([5,5,10])
|
||||
scene.addLayer(layer)
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('scene layer simplePoint', async () => {
|
||||
const layer = new PointLayer().source(
|
||||
testData,
|
||||
{
|
||||
parser: {
|
||||
type: 'json',
|
||||
x: 'x',
|
||||
y: 'y',
|
||||
},
|
||||
},
|
||||
).shape('simple')
|
||||
.color('red')
|
||||
.size(1)
|
||||
scene.addLayer(layer)
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
|
@ -10,7 +10,6 @@ export default class ReglElements implements IElements {
|
|||
|
||||
constructor(reGl: regl.Regl, options: IElementsInitializationOptions) {
|
||||
const { data, usage, type, count } = options;
|
||||
|
||||
this.elements = reGl.elements({
|
||||
data,
|
||||
usage: usageMap[usage || gl.STATIC_DRAW],
|
||||
|
|
|
@ -2,7 +2,8 @@ import gl from 'gl';
|
|||
|
||||
// borrow from regl
|
||||
// @see https://github.com/regl-project/regl/blob/gh-pages/test/util/create-context.js#L28
|
||||
const CONTEXT = gl(1, 1, { preserveDrawingBuffer: true });
|
||||
const CONTEXT = gl(400, 300, { preserveDrawingBuffer: true});
|
||||
|
||||
// @ts-ignore
|
||||
const RESIZE = CONTEXT.getExtension('STACKGL_resize_drawingbuffer');
|
||||
|
||||
|
|
|
@ -11,7 +11,32 @@ export function TestScene(options?: Partial<IMapOptions>) {
|
|||
body.appendChild(el);
|
||||
|
||||
const context = createContext(400, 300);
|
||||
const reGL = regl(context);
|
||||
const reGL = regl({
|
||||
gl:context,
|
||||
attributes: {
|
||||
alpha: true,
|
||||
// use TAA instead of MSAA
|
||||
// @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
|
||||
antialias: true,
|
||||
premultipliedAlpha: true,
|
||||
preserveDrawingBuffer: false,
|
||||
|
||||
stencil: true,
|
||||
},
|
||||
extensions: [
|
||||
'ANGLE_instanced_arrays',
|
||||
'STACKGL_resize_drawingbuffer',
|
||||
'STACKGL_destroy_context',
|
||||
'OES_element_index_uint',
|
||||
'OES_standard_derivatives',
|
||||
'OES_texture_float',
|
||||
'OES_texture_float_linear',
|
||||
'WEBGL_draw_buffers',
|
||||
'EXT_blend_minmax',
|
||||
'EXT_texture_filter_anisotropic',
|
||||
'OES_vertex_array_object',
|
||||
],
|
||||
});
|
||||
const scene = new Scene({
|
||||
id: el,
|
||||
gl: reGL,
|
||||
|
|
|
@ -35,6 +35,6 @@
|
|||
}
|
||||
},
|
||||
"include": ["packages"],
|
||||
"exclude": ["node_modules", "packages/**/dist","packages/site"]
|
||||
"exclude": ["node_modules", "packages/**/dist","packages/site","packages/leaflet/**",]
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"**/*.{test,story}.ts{,x}",
|
||||
"node_modules/**/*.d.ts",
|
||||
"packages/site/**",
|
||||
"packages/leaflet/**",
|
||||
"packages/site/node_modules/**"
|
||||
],
|
||||
"include":[
|
||||
|
|
Loading…
Reference in New Issue