@@ -11,45 +11,18 @@ describe('Module: highchartsNg', function () {
1111 usedChartConstructor ,
1212 chart ;
1313
14+
1415 // load the controller's module
1516 beforeEach ( module ( 'highcharts-ng' ) ) ;
1617
1718 beforeEach ( inject ( function ( $injector , $rootScope , _$compile_ , _$timeout_ ) {
1819 title = { } ;
1920 destroyed = false ;
20- usedChartConstructor = '' ;
21-
22- chart = jasmine . createSpyObj ( 'chart' , [
23- 'redraw' ,
24- 'setTitle' ,
25- 'hideLoading' ,
26- 'destroy' ,
27- 'get' ,
28- 'addSeries' ,
29- 'update' ] ) ;
30- chart . series = [ ] ;
31-
32- window . Highcharts = {
33- Chart : function ( opt ) {
34- options = opt ;
35- usedChartConstructor = 'Chart' ;
36-
37- return chart ;
38- } ,
39- StockChart : function ( opt ) {
40- options = opt ;
41- usedChartConstructor = 'StockChart' ;
21+ scope = $rootScope ;
4222
43- return chart ;
44- } ,
45- Map : function ( opt ) {
46- options = opt ;
47- usedChartConstructor = 'Map' ;
23+ window . Highcharts . reset ( ) ;
24+ chart = window . Highcharts . chart ;
4825
49- return chart ;
50- }
51- } ;
52- scope = $rootScope ;
5326 $compile = _$compile_ ;
5427 $timeout = _$timeout_ ;
5528
@@ -102,7 +75,7 @@ describe('Module: highchartsNg', function () {
10275
10376 it ( 'passes options to highcharts' , function ( ) {
10477 compileDirective ( 'simpleChartConfig' ) ;
105-
78+ options = window . Highcharts . options ;
10679 expect ( options . chart . type ) . toBe ( 'bar' ) ;
10780 expect ( options . chart . series ) . toBe ( templates . simpleChartConfig . series ) ;
10881 } ) ;
@@ -113,6 +86,7 @@ describe('Module: highchartsNg', function () {
11386 } ) ;
11487
11588 it ( 'uses highstocks' , function ( ) {
89+ usedChartConstructor = window . Highcharts . usedChartConstructor ;
11690 expect ( usedChartConstructor ) . toBe ( 'StockChart' ) ;
11791 } ) ;
11892 } ) ;
0 commit comments