Skip to content

Commit

Permalink
test: add test for vis @antv/g2plot (#79)
Browse files Browse the repository at this point in the history
* test: add test case for vis library

* fix: typo
  • Loading branch information
hustcc authored Feb 7, 2021
1 parent 3055dd9 commit 548278e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions __tests__/vis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* test vis @AntV/G2Plot
*/

import { Line } from '@antv/g2plot';

describe('vis', () => {
it('vis can pass', () => {
const div = document.createElement('canvas');

const line = new Line(div, {
data: [
{ x: 'A', y: 10 },
{ x: 'B', y: 20 },
{ x: 'C', y: 30 },
],
xField: 'x',
yField: 'y',
});

line.render();

expect(line.container.querySelector('canvas')).not.toBe(null);

line.destroy();

expect(line.container.querySelector('canvas')).toBe(null);
});
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-canvas-mock",
"version": "2.2.0",
"version": "2.2.1",
"description": "Mock a canvas in your jest tests.",
"main": "lib/index.js",
"types": "types/index.d.ts",
Expand All @@ -16,6 +16,7 @@
"moo-color": "^1.0.2"
},
"devDependencies": {
"@antv/g2plot": "^2.3.11",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
Expand Down

0 comments on commit 548278e

Please sign in to comment.