fix test spec

This commit is contained in:
TomHuangCN 2018-10-15 10:56:37 +08:00
parent 98eb20da5c
commit 31e40702cd
2 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@
const G6 = require('@antv/g6'); const G6 = require('@antv/g6');
const Util = G6.Util; const Util = G6.Util;
const Fisheye = require('./tool'); const Fisheye = require('./tool');
class Plugin { class Plugin {
constructor(options) { constructor(options) {
Util.mix(this, options); Util.mix(this, options);

View File

@ -1,7 +1,10 @@
const G6 = require('../../../src/index'); const G6 = require('../../../src/index');
const expect = require('chai').expect; const chai = require('chai');
const expect = chai.expect;
const Simulate = require('event-simulate'); const Simulate = require('event-simulate');
const Fisheye = require('../../../plugins/tool.fisheye/'); const Fisheye = require('../../../plugins/tool.fisheye/');
const chaiAlmost = require('chai-almost');
chai.use(chaiAlmost());
describe('fisheye test', () => { describe('fisheye test', () => {
const fisheye = new Fisheye(); const fisheye = new Fisheye();
@ -177,7 +180,7 @@ describe('fisheye test', () => {
clientX: clientPoint.x, clientX: clientPoint.x,
clientY: clientPoint.y clientY: clientPoint.y
}); });
expect([ node1Model.x, node1Model.y ]).eql([ 130, 200 ]); expect([ node1Model.x, node1Model.y ]).to.be.deep.almost([ 130, 200 ], 5);
expect(div.childNodes.length).not.eql(0); expect(div.childNodes.length).not.eql(0);
done(); done();
}, 100); }, 100);