Chart.js/test/core.scaleService.tests.js
Zach Panzarino 766ca49cd0 Extend eslint to test files (#3473)
* Add eslint to test files

* Fix mockContext for tests

* Make formatting look better for nested objects
2016-10-16 17:34:59 -04:00

30 lines
735 B
JavaScript

// Tests of the scale service
describe('Test the scale service', function() {
it('should update scale defaults', function() {
var defaults = {
testProp: true
};
var type = 'my_test_type';
var Constructor = function() {
this.initialized = true;
};
Chart.scaleService.registerScaleType(type, Constructor, defaults);
// Should equal defaults but not be an identical object
expect(Chart.scaleService.getScaleDefaults(type)).toEqual(jasmine.objectContaining({
testProp: true
}));
Chart.scaleService.updateScaleDefaults(type, {
testProp: 'red',
newProp: 42
});
expect(Chart.scaleService.getScaleDefaults(type)).toEqual(jasmine.objectContaining({
testProp: 'red',
newProp: 42
}));
});
});