antv-l7/packages/scene/__tests__/index.spec.ts

36 lines
1.0 KiB
TypeScript
Raw Normal View History

// @ts-ignore
2020-02-08 01:51:17 +08:00
import { Mapbox } from '@antv/l7-maps';
import { Scene } from '../src/';
describe('template', () => {
const el = document.createElement('div');
el.id = 'test-div-id';
2020-02-08 01:51:17 +08:00
el.style.width = '500px';
el.style.height = '500px';
document.querySelector('body')?.appendChild(el);
2020-02-08 01:51:17 +08:00
const scene = new Scene({
id: 'test-div-id',
map: new Mapbox({
style: 'dark',
center: [110.19382669582967, 30.258134],
pitch: 0,
zoom: 3,
}),
});
2020-02-08 01:51:17 +08:00
it('scene map method', () => {
expect(scene.getZoom()).toEqual(3);
expect(scene.getPitch()).toEqual(0);
2020-02-08 20:47:41 +08:00
const center = scene.getCenter();
expect(center.lng).toEqual(110.19382669582967);
expect(center.lat).toEqual(30.258134);
expect(scene.getRotation()).toEqual(-0);
2020-03-07 21:04:59 +08:00
expect(scene.getBounds()[0].map((v) => v.toFixed(5))).toEqual(
[88.22117044582802, 9.751305353647084].map((v) => v.toFixed(5)),
);
2020-02-08 20:47:41 +08:00
scene.setZoom(5);
expect(scene.getZoom()).toEqual(5);
scene.setPitch(5);
expect(scene.getPitch()).toEqual(5);
});
});