Skip to content

Commit

Permalink
Add failing test for on('filtered', cb) with focus chart
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Feb 27, 2018
1 parent c0219e7 commit 0653247
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/coordinate-grid-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,24 @@ describe('dc.coordinateGridChart', function () {
rangeChart.render();
});

it('range filter should execute filtered listener and zoom focus chart', function() {
spyOn(chart, 'focus').and.callThrough();
var expectedCallbackSignature = function (callbackChart, callbackFilter) {
expect(callbackChart).toBe(rangeChart);
expect(callbackFilter).toEqual(selectedRange);
};
var filteredCallback = jasmine.createSpy().and.callFake(expectedCallbackSignature);
rangeChart.on('filtered', filteredCallback);
expect(filteredCallback).not.toHaveBeenCalled();

rangeChart.filter(selectedRange);
expect(filteredCallback).toHaveBeenCalled();

expect(chart.focus).toHaveBeenCalled();
var focus = cleanDateRange(chart.focus.calls.argsFor(0)[0]);
expect(focus).toEqual(selectedRange);
});

it('should zoom the focus chart when range chart is brushed', function () {
spyOn(chart, 'focus').and.callThrough();
rangeChart.brush().extent(selectedRange);
Expand Down

0 comments on commit 0653247

Please sign in to comment.