mirror of
https://gitee.com/antv/g6.git
synced 2024-12-05 05:09:07 +08:00
chore(text): add lint test for ./test folder
This commit is contained in:
parent
b4443916b0
commit
8d4ee6ddbb
@ -94,7 +94,7 @@
|
||||
"publish": "node ./bin/publish.js",
|
||||
"lint": "eslint --ext .js ./src",
|
||||
"cdn": "antv-bin upload -n @antv/g6",
|
||||
"lint-fix": "eslint --ext .html,.js --fix ./src",
|
||||
"lint-fix": "eslint --ext .html,.js --fix ./src,./test",
|
||||
"prepublishOnly": "npm run build-lib && npm run build",
|
||||
"screenshot": "node ./bin/screenshot.js",
|
||||
"start": "npm run dev",
|
||||
|
@ -124,7 +124,7 @@ describe('shape node test', () => {
|
||||
const shape = rectGroup.get('children')[0];
|
||||
// 伪造 item, 仅测试接口和图形的变化,不测试一致性
|
||||
const item = {
|
||||
getContainer: function() {
|
||||
getContainer() {
|
||||
return rectGroup;
|
||||
}
|
||||
};
|
||||
@ -165,10 +165,10 @@ describe('shape node test', () => {
|
||||
const shape = rectGroup.get('children')[0];
|
||||
// 伪造 item, 仅测试接口和图形的变化,不测试一致性
|
||||
const item = {
|
||||
getContainer: function() {
|
||||
getContainer() {
|
||||
return rectGroup;
|
||||
},
|
||||
get(name) {
|
||||
get() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
@ -186,10 +186,10 @@ describe('shape node test', () => {
|
||||
const shape = rectGroup.get('children')[0];
|
||||
// 伪造 item, 仅测试接口和图形的变化,不测试一致性
|
||||
const item = {
|
||||
getContainer: function() {
|
||||
getContainer() {
|
||||
return rectGroup;
|
||||
},
|
||||
get(name) {
|
||||
get() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
@ -205,17 +205,17 @@ describe('shape node test', () => {
|
||||
it('label position', () => {
|
||||
const group = canvas.addGroup();
|
||||
group.translate(200, 200);
|
||||
const shape = factory.draw('ellipse', {
|
||||
factory.draw('ellipse', {
|
||||
size: [ 60, 20 ],
|
||||
color: 'green',
|
||||
label: 'ellipse position',
|
||||
labelPosition: 'top'
|
||||
}, group);
|
||||
const item = {
|
||||
getContainer: function() {
|
||||
getContainer() {
|
||||
return group;
|
||||
},
|
||||
get(name) {
|
||||
get() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
@ -22,9 +22,7 @@ describe('shape test', () => {
|
||||
});
|
||||
|
||||
it('register shape', () => {
|
||||
Shape.registerTest('t1', {
|
||||
|
||||
});
|
||||
Shape.registerTest('t1', {});
|
||||
const factory = Shape.getFactory('test');
|
||||
const shape = factory.getShape('t1');
|
||||
expect(shape.type).eql('t1');
|
||||
@ -33,9 +31,9 @@ describe('shape test', () => {
|
||||
|
||||
it('not allow update', () => {
|
||||
const factory = Shape.getFactory('test');
|
||||
var isDraw = false;
|
||||
var afterDraw = false;
|
||||
const t2 = Shape.registerTest('t2', {
|
||||
let isDraw = false;
|
||||
let afterDraw = false;
|
||||
Shape.registerTest('t2', {
|
||||
draw() {
|
||||
isDraw = true;
|
||||
},
|
||||
@ -51,7 +49,7 @@ describe('shape test', () => {
|
||||
|
||||
it('allow update', () => {
|
||||
const factory = Shape.getFactory('test');
|
||||
var isUpdate = false;
|
||||
let isUpdate = false;
|
||||
Shape.registerTest('t3', {
|
||||
update() {
|
||||
isUpdate = true;
|
||||
@ -64,21 +62,20 @@ describe('shape test', () => {
|
||||
|
||||
it('extend shape', () => {
|
||||
const factory = Shape.getFactory('test');
|
||||
var isUpdate = false;
|
||||
let isUpdate = false;
|
||||
Shape.registerTest('t4', {
|
||||
draw() {
|
||||
|
||||
}
|
||||
draw() {},
|
||||
update() { isUpdate = true; }
|
||||
}, 't3');
|
||||
expect(factory.shouldUpdate('t4')).eql(true);
|
||||
factory.update('t4');
|
||||
|
||||
expect(isUpdate).to.be.false;
|
||||
});
|
||||
|
||||
|
||||
it('clear', () => {
|
||||
delete Shape['Test'];
|
||||
delete Shape['registerTest'];
|
||||
delete Shape.Test;
|
||||
delete Shape.registerTest;
|
||||
expect(Shape.getFactory('test')).eql(undefined);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user