Chart.js/test/specs/controller.scatter.test.js
Simon Brunel be8d78a900
Make Chart.controllers.* importable (#5871)
`controllers.*.js` and `core.datasetController.js` are now importable (no more function export), that's why there is so many changes mainly due to one indentation level removed. Split code for `bar/horizontalBar` and `doughnut/pie` in separate files, added a global controllers import (`src/controllers/index.js`) and add tests to check that all dataset controllers are correctly registered under `chart.controllers.{type}`.
2018-11-29 21:06:34 +01:00

30 lines
706 B
JavaScript

describe('Chart.controllers.scatter', function() {
it('should be registered as dataset controller', function() {
expect(typeof Chart.controllers.scatter).toBe('function');
});
describe('showLines option', function() {
it('should not draw a line if undefined', function() {
var chart = window.acquireChart({
type: 'scatter',
data: {
datasets: [{
data: [{x: 10, y: 15}],
label: 'dataset1'
}],
},
options: {}
});
var meta = chart.getDatasetMeta(0);
spyOn(meta.dataset, 'draw');
spyOn(meta.data[0], 'draw');
chart.update();
expect(meta.dataset.draw.calls.count()).toBe(0);
expect(meta.data[0].draw.calls.count()).toBe(1);
});
});
});