core.scaleService.tests.js 737 Bytes
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// 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
		}));
	});
});