maxklenk/angular-chart — pull request #33 by ulilicht (2014-11-28 13:37:35+00:00)
Title: Expose the "resize()" function of c3 to angular

Hi Max,

I'd like to expose the resize() function from c3; I need to call it when resizing the div which contains the chart but not resizing the window itself.

Unfortunately, I could not figure out how to test this functionality. I don't know how to get the "chart" property of the directive in the test. If I could, I would maybe test it like this:

describe('. resize', function () {
it('- Resize on chart should be callable from outside.', function () {

directiveScope.chart = {resize: angular.noop};
spyOn(directiveScope.chart, 'resize');
elementScope.options.resize();

expect(directiveScope.chart.resize()).toHaveBeenCalled();

});
});

Where directiveScope is the scope of the Directive and elementScope is the scope of outside.