From 1be71030ff0ea387e22ef728a73f13ad1165c4d3 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Tue, 29 Jan 2019 09:24:19 -0800 Subject: [PATCH] Don't alter value of global variables in test. Tests are not isolated from each other --- test/specs/core.controller.tests.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index 819074393b1..8edf74e850f 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -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' @@ -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: {