Skip to content

Commit

Permalink
Don't alter value of global variables in test. Tests are not isolated…
Browse files Browse the repository at this point in the history
… from each other
  • Loading branch information
benmccann committed Jan 29, 2019
1 parent 852e1b3 commit 1be7103
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions test/specs/core.controller.tests.js
Expand Up @@ -64,13 +64,7 @@ describe('Chart', function() {
});

it('should initialize config with default options', function() {
var callback = function() {};

var defaults = Chart.defaults;
defaults.global.responsiveAnimationDuration = 42;
defaults.global.hover.onHover = callback;
defaults.line.hover.mode = 'x-axis';
defaults.line.spanGaps = true;

var chart = acquireChart({
type: 'line'
Expand All @@ -79,18 +73,13 @@ describe('Chart', function() {
var options = chart.options;
expect(options.defaultFontSize).toBe(defaults.global.defaultFontSize);
expect(options.showLines).toBe(defaults.line.showLines);
expect(options.spanGaps).toBe(true);
expect(options.responsiveAnimationDuration).toBe(42);
expect(options.hover.onHover).toBe(callback);
expect(options.hover.mode).toBe('x-axis');
expect(options.spanGaps).toBe(defaults.line.spanGaps);
expect(options.responsiveAnimationDuration).toBe(defaults.global.responsiveAnimationDuration);
expect(options.hover.onHover).toBe(defaults.global.hover.onHover);
expect(options.hover.mode).toBe(defaults.line.hover.mode);
});

it('should override default options', function() {
var defaults = Chart.defaults;
defaults.global.responsiveAnimationDuration = 42;
defaults.line.hover.mode = 'x-axis';
defaults.line.spanGaps = true;

var chart = acquireChart({
type: 'line',
options: {
Expand Down

0 comments on commit 1be7103

Please sign in to comment.