GraFiddle / angular-chart

AngularJS directive for adjustable dynamically updating c3 charts
http://grafiddle.github.io/angular-chart/
MIT License
127 stars 40 forks source link

Expose the "resize()" function of c3 to angular #33

Closed ulilicht closed 9 years ago

ulilicht commented 9 years ago

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.

ulilicht commented 9 years ago

Ah, and it seems that i submitted the pull request to master instead of develop - can you change this?

coveralls commented 9 years ago

Coverage Status

Coverage decreased (-0.35%) when pulling 99f2fdeabac0590112f81b166ea15b672ac1c96c on ulilicht:develop into 1c2b210033c96620e5ed008c34b5cbaa9f6be807 on maxklenk:master.

ulilicht commented 9 years ago

ok, please don't merge - there is an error with the brackets, didn't see that before. I'll submit a new, clean pull request ( to the correct branch ;-) )