antv-l7/packages/component/__tests__/fullscreen.spec.ts

28 lines
737 B
TypeScript

import { TestScene } from '@antv/l7-test-utils';
import Fullscreen from '../src/control/fullscreen';
describe('fullscreen', () => {
const scene = TestScene();
it('life cycle', () => {
const control = new Fullscreen({});
scene.addControl(control);
const container = control.getContainer();
expect(container.parentElement).toBeInstanceOf(HTMLElement);
scene.removeControl(control);
expect(container.parentElement).not.toBeInstanceOf(HTMLElement);
});
it('fullscreen', () => {
const control = new Fullscreen({});
scene.addControl(control);
const button = control.getContainer() as HTMLDivElement;
button.click();
expect(button.parentElement).toBeInstanceOf(HTMLElement);
});
});