Skip to content

Commit

Permalink
test: add test case for issue 488, the bug has fixed at antvis/adjust#2
Browse files Browse the repository at this point in the history
…, Closed #488.
  • Loading branch information
simaQ committed Feb 11, 2019
1 parent 7e4a761 commit e4381e0
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/bug/issue-488-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const expect = require('chai').expect;
const F2 = require('../../src/core');
require('../../src/geom/interval');
require('../../src/geom/adjust/dodge');

describe('Issue 488', () => {
let canvas;
let chart;
before(() => {
canvas = document.createElement('canvas');
canvas.width = 300;
canvas.height = 300;
canvas.id = 'issue488';
document.body.appendChild(canvas);
});

it('Issue 488', () => {
const data = [
{ name: 'London', 月份: 'Jan.', 月均降雨量: 18.9 },
{ name: 'Berlin', 月份: 'Jan.', 月均降雨量: 12.4 }
];
chart = new F2.Chart({
id: 'issue488',
pixelRatio: window.devicePixelRatio
});

chart.source(data);
const interval = chart.interval()
.position('月份*月均降雨量')
.color('name')
.adjust({
type: 'dodge',
marginRatio: 0
});
chart.render();

const dataArray = interval.get('dataArray');
expect(dataArray[0][0].points[0].x).to.equal(0.25);
expect(dataArray[1][0].points[0].x).to.equal(0.5);
});

after(() => {
chart.destroy();
document.body.removeChild(canvas);
});
});

0 comments on commit e4381e0

Please sign in to comment.