mirror of
https://gitee.com/antv/g6.git
synced 2024-12-01 03:08:33 +08:00
test: plugin import in tests
This commit is contained in:
parent
00c7a770cb
commit
f095a89696
@ -49,7 +49,7 @@
|
||||
"site:develop": "GATSBY=true gatsby develop --open",
|
||||
"start": "npm run site:develop",
|
||||
"test": "jest",
|
||||
"test-live": "DEBUG_MODE=1 jest --watch ./tests/unit/graph/graph-spec.ts",
|
||||
"test-live": "DEBUG_MODE=1 jest --watch ./tests/unit/plugins/",
|
||||
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx",
|
||||
"watch": "father build -w",
|
||||
"cdn": "antv-bin upload -n @antv/g6"
|
||||
|
@ -21,6 +21,6 @@ export default {
|
||||
Global,
|
||||
Minimap: Plugins.Minimap,
|
||||
Grid: Plugins.Grid,
|
||||
EdgeBundling: Plugins.Bundling,
|
||||
Bundling: Plugins.Bundling,
|
||||
Menu: Plugins.Menu
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import G6 from '../../../src'
|
||||
import Bundling from '../../../src/plugins/bundling'
|
||||
import { data } from './data'
|
||||
import { GraphData } from '../../../src/types'
|
||||
|
||||
@ -22,7 +21,7 @@ describe('edge bundling', () => {
|
||||
graph.render();
|
||||
|
||||
it('edge bundling on circular layout with default configs', () => {
|
||||
const bundle = new Bundling();
|
||||
const bundle = new G6.Bundling();
|
||||
bundle.initPlugin(graph);
|
||||
|
||||
const graphData = graph.save()
|
||||
@ -34,7 +33,7 @@ describe('edge bundling', () => {
|
||||
});
|
||||
|
||||
it('bundling on circular with fixed bundleThreshold and iterations', () => {
|
||||
const bundle = new Bundling({
|
||||
const bundle = new G6.Bundling({
|
||||
iterations: 120,
|
||||
bundleThreshold: 0.1,
|
||||
});
|
||||
@ -59,7 +58,7 @@ describe('edge bundling', () => {
|
||||
};
|
||||
graph.changeData(data2);
|
||||
|
||||
const bundle = new Bundling();
|
||||
const bundle = new G6.Bundling();
|
||||
bundle.initPlugin(graph);
|
||||
bundle.bundling(data2);
|
||||
|
||||
@ -85,7 +84,7 @@ describe('edge bundling', () => {
|
||||
});
|
||||
|
||||
it('bundling no position info, throw error', () => {
|
||||
const bundle = new Bundling();
|
||||
const bundle = new G6.Bundling();
|
||||
bundle.initPlugin(graph);
|
||||
|
||||
const data2: GraphData = {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import Grid from '../../../src/plugins/grid';
|
||||
import G6 from '../../../src';
|
||||
|
||||
const div = document.createElement('div');
|
||||
@ -6,7 +5,7 @@ div.id = 'grid-spec';
|
||||
document.body.appendChild(div);
|
||||
|
||||
describe('grid', () => {
|
||||
const grid = new Grid();
|
||||
const grid = new G6.Grid();
|
||||
const graph = new G6.Graph({
|
||||
container: div,
|
||||
width: 800,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Simulate from 'event-simulate';
|
||||
import Menu from '../../../src/plugins/menu';
|
||||
import G6 from '../../../src';
|
||||
|
||||
const div = document.createElement('div');
|
||||
@ -14,7 +13,7 @@ describe('menu', () => {
|
||||
it('init & destroy', () => {
|
||||
let count = 0;
|
||||
let hide = true;
|
||||
const menu = new Menu({
|
||||
const menu = new G6.Menu({
|
||||
onShow(e) {
|
||||
expect(isNaN(e.canvasX)).toBe(false);
|
||||
expect(isNaN(e.canvasY)).toBe(false);
|
||||
@ -78,7 +77,7 @@ describe('menu', () => {
|
||||
outDiv.style.visibility = 'hidde';
|
||||
document.body.appendChild(outDiv);
|
||||
|
||||
const menu = new Menu({
|
||||
const menu = new G6.Menu({
|
||||
createDOM: false,
|
||||
menu: outDiv,
|
||||
getContent(e) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
import G6 from '../../../src'
|
||||
import Minimap from '../../../src/plugins/minimap'
|
||||
import Simulate from 'event-simulate'
|
||||
import { timerOut } from '../util/timeOut'
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.id = 'minimap';
|
||||
@ -12,7 +10,7 @@ div.appendChild(container);
|
||||
describe('minimap', () => {
|
||||
|
||||
it('minimap with default settings & destroy', () => {
|
||||
const minimap = new Minimap({ size: [ 200, 200 ] });
|
||||
const minimap = new G6.Minimap({ size: [ 200, 200 ] });
|
||||
const graph = new G6.Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
@ -79,7 +77,7 @@ describe('minimap', () => {
|
||||
expect(viewport.style.height).toEqual('160px');
|
||||
});
|
||||
xit('move viewport', () => {
|
||||
const minimap = new Minimap({ size: [ 200, 200 ] });
|
||||
const minimap = new G6.Minimap({ size: [ 200, 200 ] });
|
||||
const graph = new G6.Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
@ -155,7 +153,7 @@ describe('minimap', () => {
|
||||
// }, 50);
|
||||
});
|
||||
it('delegate type of minimap', () => {
|
||||
const minimap = new Minimap({
|
||||
const minimap = new G6.Minimap({
|
||||
size: [ 200, 200 ],
|
||||
type: 'delegate',
|
||||
delegateStyle: {
|
||||
@ -184,7 +182,7 @@ describe('minimap', () => {
|
||||
graph.destroy();
|
||||
});
|
||||
it('minimap container', () => {
|
||||
const minimap = new Minimap({
|
||||
const minimap = new G6.Minimap({
|
||||
container,
|
||||
size: [ 200, 200 ],
|
||||
className: 'test-className'
|
||||
@ -218,7 +216,7 @@ describe('minimap', () => {
|
||||
expect(container.innerHTML).toEqual('');
|
||||
});
|
||||
it('canvas minX minY < 0', () => {
|
||||
const minimap = new Minimap({ size: [ 200, 200 ] });
|
||||
const minimap = new G6.Minimap({ size: [ 200, 200 ] });
|
||||
const graph = new G6.Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
@ -240,7 +238,7 @@ describe('minimap', () => {
|
||||
graph.destroy();
|
||||
});
|
||||
it('keyShapeOnly minimap', () => {
|
||||
const minimap = new Minimap({ size: [ 200, 200 ], type: 'keyShape' });
|
||||
const minimap = new G6.Minimap({ size: [ 200, 200 ], type: 'keyShape' });
|
||||
const graph = new G6.Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
|
Loading…
Reference in New Issue
Block a user