core.scaleService.tests.js 737 B

1234567891011121314151617181920212223242526272829
  1. // Tests of the scale service
  2. describe('Test the scale service', function() {
  3. it('should update scale defaults', function() {
  4. var defaults = {
  5. testProp: true
  6. };
  7. var type = 'my_test_type';
  8. var Constructor = function() {
  9. this.initialized = true;
  10. };
  11. Chart.scaleService.registerScaleType(type, Constructor, defaults);
  12. // Should equal defaults but not be an identical object
  13. expect(Chart.scaleService.getScaleDefaults(type)).toEqual(jasmine.objectContaining({
  14. testProp: true
  15. }));
  16. Chart.scaleService.updateScaleDefaults(type, {
  17. testProp: 'red',
  18. newProp: 42
  19. });
  20. expect(Chart.scaleService.getScaleDefaults(type)).toEqual(jasmine.objectContaining({
  21. testProp: 'red',
  22. newProp: 42
  23. }));
  24. });
  25. });