Chart.js/test/index.js
Igor Lukanin 1c2f66a00e
Introduce Colors plugin (#10764)
Introduces a colors plugin that provides a color palette

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
2022-10-21 08:21:08 -04:00

37 lines
993 B
JavaScript

import {acquireChart, releaseChart, createMockContext, afterEvent, waitForResize, injectWrapperCSS, specsFromFixtures, triggerMouseEvent, addMatchers, releaseCharts} from 'chartjs-test-utils';
// force ratio=1 for tests on high-res/retina devices
// fixes https://github.com/chartjs/Chart.js/issues/4515
window.devicePixelRatio = 1;
window.acquireChart = acquireChart;
window.afterEvent = afterEvent;
window.releaseChart = releaseChart;
window.waitForResize = waitForResize;
window.createMockContext = createMockContext;
injectWrapperCSS();
jasmine.fixture = {
specs: specsFromFixtures
};
jasmine.triggerMouseEvent = triggerMouseEvent;
// Set a fixed time zone (and, in particular, disable Daylight Saving Time) for
// more stable test results.
window.moment.tz.setDefault('Etc/UTC');
beforeAll(() => {
// Disable colors plugin for tests.
window.Chart.defaults.plugins.colors.enabled = false;
});
beforeEach(() => {
addMatchers();
});
afterEach(() => {
releaseCharts();
});