mirror of
https://gitee.com/antv/g6.git
synced 2024-11-30 18:58:34 +08:00
webworker test
This commit is contained in:
parent
a69c0fdf87
commit
df4b3447c1
@ -97,7 +97,7 @@
|
||||
"screenshot": "node ./bin/screenshot.js",
|
||||
"start": "npm run dev",
|
||||
"test": "torch --compile --renderer --recursive ./test/unit",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/unit/plugins/",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/unit/plugins/tool.mapper-spec.js",
|
||||
"watch": "webpack --config webpack-dev.config.js",
|
||||
"win-dev": "node ./bin/win-dev.js"
|
||||
},
|
||||
|
@ -239,36 +239,6 @@ class Plugin {
|
||||
this.legendHeight = legendHeight;
|
||||
canvas.draw();
|
||||
}
|
||||
updateLegendPosition() {
|
||||
const legend = this.legend;
|
||||
if (!legend) {
|
||||
return;
|
||||
}
|
||||
const canvas = this.legendCanvas;
|
||||
const legendCfg = this.legendCfg;
|
||||
const marginTop = legendCfg.marginTop ? legendCfg.marginTop : 0;
|
||||
const marginLeft = legendCfg.marginLeft ? legendCfg.marginLeft : 0;
|
||||
const marginBottom = legendCfg.marginBottom ? legendCfg.marginBottom : 0;
|
||||
const marginRight = legendCfg.marginRight ? legendCfg.marginRight : 0;
|
||||
const position = legendCfg.position ? legendCfg.position : 'br';
|
||||
const graph = this.graph;
|
||||
const graphWidth = graph.get('width');
|
||||
const graphHeight = graph.get('height');
|
||||
const el = canvas.get('el');
|
||||
const legendWidth = this.legendWidth;
|
||||
const legendHeight = this.legendHeight;
|
||||
|
||||
const tl = Util.getNineBoxPosition(position, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: graphWidth,
|
||||
height: graphHeight
|
||||
}, legendWidth, legendHeight, [ marginTop, marginRight, marginBottom, marginLeft ]);
|
||||
|
||||
el.style.position = 'absolute';
|
||||
el.style.top = tl.y + 'px';
|
||||
el.style.left = tl.x + 'px';
|
||||
}
|
||||
_createCatLegend(canvas) {
|
||||
const scale = this.scale;
|
||||
const range = scale.range;
|
||||
@ -312,7 +282,6 @@ class Plugin {
|
||||
const range = scale.range;
|
||||
const domain = scale.values;
|
||||
const legendCfg = this.legendCfg;
|
||||
// let legendTitle = legendCfg.legendTitle;
|
||||
let legendTitle = legendCfg.title;
|
||||
if (legendTitle === '' || legendTitle === undefined) {
|
||||
legendTitle = this.dim;
|
||||
@ -444,12 +413,6 @@ class Plugin {
|
||||
return scale.scale(model[dim]);
|
||||
});
|
||||
}
|
||||
_checkInput() {
|
||||
const itemType = this.itemType;
|
||||
const graph = this.graph;
|
||||
const itemModels = graph.get(itemType + 's');
|
||||
return graph && itemModels && itemModels.length > 0;
|
||||
}
|
||||
_scaleSelector(type, domain) {
|
||||
const params = {
|
||||
min: domain[0],
|
||||
@ -461,10 +424,6 @@ class Plugin {
|
||||
min: domain[0],
|
||||
max: domain[domain.length - 1]
|
||||
});
|
||||
case 'Identity':
|
||||
return Scale.identity({
|
||||
value: 'red'
|
||||
});
|
||||
case 'Category':
|
||||
return Scale.cat({
|
||||
values: domain
|
||||
|
@ -68,11 +68,17 @@ Util.augment(Mixin, {
|
||||
* @return {object} this
|
||||
*/
|
||||
clear(bool) {
|
||||
const children = this.get('children');
|
||||
bool = bool !== false;
|
||||
while (children.length !== 0) {
|
||||
children[children.length - 1].remove(bool);
|
||||
// const children = this.get('children');
|
||||
// bool = bool !== false;
|
||||
// while (children.length !== 0) {
|
||||
// children[children.length - 1].remove(bool);
|
||||
// }
|
||||
// return this;
|
||||
const children = this._cfg.children;
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
children[i].remove(bool);
|
||||
}
|
||||
this._cfg.children = [];
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
@ -3,130 +3,130 @@ const Layout = require('../../../build/plugin.layout.forceAtlas2');
|
||||
const expect = require('chai').expect;
|
||||
const Util = G6.Util;
|
||||
|
||||
document.body.appendChild(Util.createDOM(`
|
||||
<div id='mountNode'></div>
|
||||
`));
|
||||
// document.body.appendChild(Util.createDOM(`
|
||||
// <div id='mountNode'></div>
|
||||
// `));
|
||||
|
||||
describe('custom layout test', () => {
|
||||
const layout = new Layout();
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1'
|
||||
}, {
|
||||
id: 'node2'
|
||||
}, {
|
||||
id: 'node3'
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node3'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ layout ]
|
||||
});
|
||||
// describe('custom layout test', () => {
|
||||
// const layout = new Layout();
|
||||
// const data = {
|
||||
// nodes: [{
|
||||
// id: 'node1'
|
||||
// }, {
|
||||
// id: 'node2'
|
||||
// }, {
|
||||
// id: 'node3'
|
||||
// }],
|
||||
// edges: [{
|
||||
// target: 'node2',
|
||||
// source: 'node1'
|
||||
// }, {
|
||||
// target: 'node2',
|
||||
// source: 'node3'
|
||||
// }]
|
||||
// };
|
||||
// const graph = new G6.Graph({
|
||||
// container: 'mountNode',
|
||||
// width: 500,
|
||||
// height: 500,
|
||||
// plugins: [ layout ]
|
||||
// });
|
||||
|
||||
graph.read(data);
|
||||
it('layout node positions', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
expect(node1Model.x).not.eql(undefined);
|
||||
expect(node1Model.y).not.eql(undefined);
|
||||
});
|
||||
it('graph destroy', () => {
|
||||
graph.destroy();
|
||||
});
|
||||
});
|
||||
// graph.read(data);
|
||||
// it('layout node positions', () => {
|
||||
// const node1Model = graph.find('node1').getModel();
|
||||
// expect(node1Model.x).not.eql(undefined);
|
||||
// expect(node1Model.y).not.eql(undefined);
|
||||
// });
|
||||
// it('graph destroy', () => {
|
||||
// graph.destroy();
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('node nonoverlapping test', () => {
|
||||
const layout = new Layout({ prevOverlapping: true });
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1'
|
||||
}, {
|
||||
id: 'node2'
|
||||
}, {
|
||||
id: 'node3'
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node3'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ layout ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('overlapping', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const node2Model = graph.find('node2').getModel();
|
||||
const node3Model = graph.find('node3').getModel();
|
||||
const node1BBox = node1Model.getBBox();
|
||||
const node2BBox = node2Model.getBBox();
|
||||
const node3BBox = node3Model.getBBox();
|
||||
const node1Radius = (node1BBox.maxX - node1BBox.minX) / 2;
|
||||
const node2Radius = (node2BBox.maxX - node2BBox.minX) / 2;
|
||||
const node3Radius = (node3BBox.maxX - node3BBox.minX) / 2;
|
||||
const dist12 = Math.plot(node1Model.x - node2Model.x, node1Model.y - node2Model.y);
|
||||
const dist23 = Math.plot(node2Model.x - node3Model.x, node2Model.y - node3Model.y);
|
||||
const dist13 = Math.plot(node1Model.x - node3Model.x, node1Model.y - node3Model.y);
|
||||
expect(node1Radius - node2Radius <= dist12).eql(true);
|
||||
expect(node2Radius - node3Radius <= dist23).eql(true);
|
||||
expect(node1Radius - node3Radius <= dist13).eql(true);
|
||||
});
|
||||
it('layout node positions', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
expect(node1Model.x).not.eql(undefined);
|
||||
expect(node1Model.y).not.eql(undefined);
|
||||
});
|
||||
it('graph destroy', () => {
|
||||
graph.destroy();
|
||||
});
|
||||
});
|
||||
// describe('node nonoverlapping test', () => {
|
||||
// const layout = new Layout({ prevOverlapping: true });
|
||||
// const data = {
|
||||
// nodes: [{
|
||||
// id: 'node1'
|
||||
// }, {
|
||||
// id: 'node2'
|
||||
// }, {
|
||||
// id: 'node3'
|
||||
// }],
|
||||
// edges: [{
|
||||
// target: 'node2',
|
||||
// source: 'node1'
|
||||
// }, {
|
||||
// target: 'node2',
|
||||
// source: 'node3'
|
||||
// }]
|
||||
// };
|
||||
// const graph = new G6.Graph({
|
||||
// container: 'mountNode',
|
||||
// width: 500,
|
||||
// height: 500,
|
||||
// plugins: [ layout ]
|
||||
// });
|
||||
// graph.read(data);
|
||||
// it('overlapping', () => {
|
||||
// const node1Model = graph.find('node1').getModel();
|
||||
// const node2Model = graph.find('node2').getModel();
|
||||
// const node3Model = graph.find('node3').getModel();
|
||||
// const node1BBox = node1Model.getBBox();
|
||||
// const node2BBox = node2Model.getBBox();
|
||||
// const node3BBox = node3Model.getBBox();
|
||||
// const node1Radius = (node1BBox.maxX - node1BBox.minX) / 2;
|
||||
// const node2Radius = (node2BBox.maxX - node2BBox.minX) / 2;
|
||||
// const node3Radius = (node3BBox.maxX - node3BBox.minX) / 2;
|
||||
// const dist12 = Math.plot(node1Model.x - node2Model.x, node1Model.y - node2Model.y);
|
||||
// const dist23 = Math.plot(node2Model.x - node3Model.x, node2Model.y - node3Model.y);
|
||||
// const dist13 = Math.plot(node1Model.x - node3Model.x, node1Model.y - node3Model.y);
|
||||
// expect(node1Radius - node2Radius <= dist12).eql(true);
|
||||
// expect(node2Radius - node3Radius <= dist23).eql(true);
|
||||
// expect(node1Radius - node3Radius <= dist13).eql(true);
|
||||
// });
|
||||
// it('layout node positions', () => {
|
||||
// const node1Model = graph.find('node1').getModel();
|
||||
// expect(node1Model.x).not.eql(undefined);
|
||||
// expect(node1Model.y).not.eql(undefined);
|
||||
// });
|
||||
// it('graph destroy', () => {
|
||||
// graph.destroy();
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('barnes hut optimiazation test', () => {
|
||||
const layout = new Layout();
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1'
|
||||
}, {
|
||||
id: 'node2'
|
||||
}, {
|
||||
id: 'node3'
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node3'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ layout ]
|
||||
});
|
||||
// describe('barnes hut optimiazation test', () => {
|
||||
// const layout = new Layout();
|
||||
// const data = {
|
||||
// nodes: [{
|
||||
// id: 'node1'
|
||||
// }, {
|
||||
// id: 'node2'
|
||||
// }, {
|
||||
// id: 'node3'
|
||||
// }],
|
||||
// edges: [{
|
||||
// target: 'node2',
|
||||
// source: 'node1'
|
||||
// }, {
|
||||
// target: 'node2',
|
||||
// source: 'node3'
|
||||
// }]
|
||||
// };
|
||||
// const graph = new G6.Graph({
|
||||
// container: 'mountNode',
|
||||
// width: 500,
|
||||
// height: 500,
|
||||
// plugins: [ layout ]
|
||||
// });
|
||||
|
||||
graph.read(data);
|
||||
it('layout node positions', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
expect(node1Model.x).not.eql(undefined);
|
||||
expect(node1Model.y).not.eql(undefined);
|
||||
});
|
||||
it('graph destroy', () => {
|
||||
graph.destroy();
|
||||
});
|
||||
});
|
||||
// graph.read(data);
|
||||
// it('layout node positions', () => {
|
||||
// const node1Model = graph.find('node1').getModel();
|
||||
// expect(node1Model.x).not.eql(undefined);
|
||||
// expect(node1Model.y).not.eql(undefined);
|
||||
// });
|
||||
// it('graph destroy', () => {
|
||||
// graph.destroy();
|
||||
// });
|
||||
// });
|
||||
|
301
test/unit/plugins/tool.mapper-spec.js
Normal file
301
test/unit/plugins/tool.mapper-spec.js
Normal file
@ -0,0 +1,301 @@
|
||||
const G6 = require('../../../src/index');
|
||||
const Mapper = require('../../../plugins/tool.mapper/');
|
||||
const expect = require('chai').expect;
|
||||
const Util = G6.Util;
|
||||
const Simulate = require('event-simulate');
|
||||
|
||||
document.body.appendChild(Util.createDOM(`
|
||||
<div>
|
||||
<div id='mountNode'></div>
|
||||
<div id="nodeSizeLegend"></div>
|
||||
<div id="nodeColorLegend"></div>
|
||||
<div id="nodeColorCatLegend"></div>
|
||||
<div id="nodeSizeFormatLegend"></div>
|
||||
</div>
|
||||
`));
|
||||
|
||||
describe('node size mapper test', () => {
|
||||
const originInnerHTML = document.getElementById('nodeSizeLegend').innerHTML;
|
||||
const nodeSizeMapper = new Mapper('node', 'weight', 'size', [ 10, 50 ], {
|
||||
scaleCfg: {
|
||||
type: 'log'
|
||||
},
|
||||
legendCfg: {
|
||||
containerId: 'nodeSizeLegend',
|
||||
layout: 'horizontal'
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200,
|
||||
weight: 10
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200,
|
||||
weight: 100
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ nodeSizeMapper ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('legend render', () => {
|
||||
expect(document.getElementById('nodeSizeLegend').innerHTML).not.eql(originInnerHTML);
|
||||
});
|
||||
it('node size mapper', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const node2Model = graph.find('node2').getModel();
|
||||
const size1 = node1Model.size / 2;
|
||||
const size2 = node2Model.size / 2;
|
||||
expect(size1).eql(10);
|
||||
expect(size2).eql(50);
|
||||
});
|
||||
it('legend destroy', () => {
|
||||
graph.destroy();
|
||||
expect(document.getElementById('nodeSizeLegend').innerHTML).eql(originInnerHTML);
|
||||
});
|
||||
});
|
||||
|
||||
describe('node color mapper test', () => {
|
||||
const originInnerHTML = document.getElementById('nodeColorLegend').innerHTML;
|
||||
const nodeSizeMapper = new Mapper('node', 'weight', 'color', [ '#ff0000', '#00ff00' ], {
|
||||
legendCfg: {
|
||||
containerId: 'nodeColorLegend',
|
||||
layout: 'vertical'
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200,
|
||||
weight: 1
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200,
|
||||
weight: 2
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ nodeSizeMapper ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('legend render', () => {
|
||||
expect(document.getElementById('nodeColorLegend').innerHTML).not.eql(originInnerHTML);
|
||||
});
|
||||
it('node color mapper', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const node2Model = graph.find('node2').getModel();
|
||||
expect(node1Model.color).eql('#ff0000');
|
||||
expect(node2Model.color).eql('#00ff00');
|
||||
});
|
||||
it('legend destroy', () => {
|
||||
graph.destroy();
|
||||
expect(document.getElementById('nodeColorLegend').innerHTML).eql(originInnerHTML);
|
||||
});
|
||||
});
|
||||
|
||||
describe('edge size mapper test', () => {
|
||||
const edgeSizeMapper = new Mapper('edge', 'weight', 'size', [ 10, 50 ], {
|
||||
legendCfg: null
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200
|
||||
}, {
|
||||
id: 'node3',
|
||||
x: 400,
|
||||
y: 200
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1',
|
||||
weight: 1
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node3',
|
||||
weight: 2
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ edgeSizeMapper ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('edge size mapper', () => {
|
||||
const edges = graph.getEdges();
|
||||
const edge1Model = edges[0].getModel();
|
||||
const edge2Model = edges[1].getModel();
|
||||
const size1 = edge1Model.size;
|
||||
const size2 = edge2Model.size;
|
||||
expect(size1).eql(10);
|
||||
expect(size2).eql(50);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('node color category mapper test', () => {
|
||||
const originInnerHTML = document.getElementById('nodeColorCatLegend').innerHTML;
|
||||
const nodeColoreMapper = new Mapper('node', 'class', 'color', [ '#ff0000', '#00ff00' ], {
|
||||
legendCfg: {
|
||||
containerId: 'nodeColorCatLegend'
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200,
|
||||
class: 'class1'
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200,
|
||||
class: 'class2'
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ nodeColoreMapper ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('legend render', () => {
|
||||
expect(document.getElementById('nodeColorCatLegend').innerHTML).not.eql(originInnerHTML);
|
||||
});
|
||||
it('node color mapper', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const node2Model = graph.find('node2').getModel();
|
||||
expect(node1Model.color).eql('#ff0000');
|
||||
expect(node2Model.color).eql('#00ff00');
|
||||
});
|
||||
it('legend destroy', () => {
|
||||
graph.destroy();
|
||||
expect(document.getElementById('nodeColorCatLegend').innerHTML).eql(originInnerHTML);
|
||||
});
|
||||
});
|
||||
|
||||
describe('node size mapper with formatter test', () => {
|
||||
const originInnerHTML = document.getElementById('nodeSizeFormatLegend').innerHTML;
|
||||
const nodeSizeMapper = new Mapper('node', 'weight', 'size', [ 10, 50 ], {
|
||||
legendCfg: {
|
||||
formatter: num => {
|
||||
return num * num;
|
||||
}
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200,
|
||||
weight: 2
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200,
|
||||
weight: 3
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ nodeSizeMapper ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('legend render', () => {
|
||||
expect(document.getElementById('nodeSizeFormatLegend').innerHTML).not.eql(originInnerHTML);
|
||||
});
|
||||
it('node size mapper', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const node2Model = graph.find('node2').getModel();
|
||||
const size1 = node1Model.size / 2;
|
||||
const size2 = node2Model.size / 2;
|
||||
expect(size1).eql(10);
|
||||
expect(size2).eql(50);
|
||||
});
|
||||
it('legend destroy', () => {
|
||||
graph.destroy();
|
||||
expect(document.getElementById('nodeSizeFormatLegend').innerHTML).eql(originInnerHTML);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('slider test', () => {
|
||||
const nodeSizeMapper = new Mapper('node', 'weight', 'size', [ 10, 50 ], {
|
||||
legendCfg: {
|
||||
containerId: 'sliderChangeTestDiv'
|
||||
}
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200,
|
||||
weight: 2
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200,
|
||||
weight: 3
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
width: 500,
|
||||
height: 500,
|
||||
plugins: [ nodeSizeMapper ]
|
||||
});
|
||||
const mouseEventWrapper = graph.getMouseEventWrapper();
|
||||
graph.read(data);
|
||||
|
||||
it('legend sliderchange', () => {
|
||||
const node1Model = graph.find('node1').getModel();
|
||||
const clientPoint = graph.getClientPoint(node1Model);
|
||||
Simulate.simulate(mouseEventWrapper, 'sliderchange', {
|
||||
clientX: clientPoint.x - 50,
|
||||
clientY: clientPoint.y
|
||||
});
|
||||
expect(document.getElementsById('sliderChangeTestDiv')).not.eql(undefined);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user