New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support configurable update #4362
Changes from 4 commits
ae86fb9
270286d
0db97cc
bb6c771
fe2098d
5cb7b3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,80 @@ | ||
describe('Deprecations', function() { | ||
describe('Version 2.7.0', function() { | ||
describe('Chart.Controller.update(duration, lazy)', function() { | ||
var chart; | ||
var addAnimationSpy; | ||
|
||
beforeEach(function() { | ||
chart = acquireChart({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to avoid global variables and use this.chart = ...
this.addAnimationSpy = ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are declared inside the |
||
type: 'doughnut', | ||
data: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need data for this unit tests? |
||
labels: ['A', 'B', 'C', 'D'], | ||
datasets: [{ | ||
data: [10, 20, 30, 100] | ||
}] | ||
}, | ||
options: { | ||
cutoutPercentage: 85, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this option relevant? we should avoid setting data/options that are not useful for the test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both |
||
animation: { | ||
easing: 'linear', | ||
duration: 500 | ||
} | ||
} | ||
}); | ||
|
||
addAnimationSpy = spyOn(Chart.animationService, 'addAnimation'); | ||
}); | ||
|
||
it('adds an animation with the provided options', function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
chart.update(800, false); | ||
|
||
expect(addAnimationSpy).toHaveBeenCalledWith( | ||
chart, | ||
jasmine.objectContaining({easing: 'linear'}), | ||
800, | ||
false | ||
); | ||
}); | ||
}); | ||
|
||
describe('Chart.Controller.render(duration, lazy)', function() { | ||
var chart; | ||
var addAnimationSpy; | ||
|
||
beforeEach(function() { | ||
chart = acquireChart({ | ||
type: 'doughnut', | ||
data: { | ||
labels: ['A', 'B', 'C', 'D'], | ||
datasets: [{ | ||
data: [10, 20, 30, 100] | ||
}] | ||
}, | ||
options: { | ||
cutoutPercentage: 85, | ||
animation: { | ||
easing: 'linear', | ||
duration: 500 | ||
} | ||
} | ||
}); | ||
|
||
addAnimationSpy = spyOn(Chart.animationService, 'addAnimation'); | ||
}); | ||
|
||
it('adds an animation with the provided options', function() { | ||
chart.render(800, true); | ||
|
||
expect(addAnimationSpy).toHaveBeenCalledWith( | ||
chart, | ||
jasmine.objectContaining({easing: 'linear'}), | ||
800, | ||
true | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Version 2.6.0', function() { | ||
// https://github.com/chartjs/Chart.js/issues/2481 | ||
describe('Chart.Controller', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a test, if possible, that verifies that backwards compatibility isn't broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try that. Is there any other place other than
core.controller.tests.js
? Because that isn't testing_bufferedRender
, norrender
at the moment.