File tree Expand file tree Collapse file tree 7 files changed +145
-0
lines changed Expand file tree Collapse file tree 7 files changed +145
-0
lines changed Original file line number Diff line number Diff line change @@ -40,4 +40,25 @@ describe('BarChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#barchartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+
44
+ it ( 'should destroy chart instance' , ( done ) => {
45
+ const vm = new Vue ( {
46
+ render : function ( createElement ) {
47
+ return createElement (
48
+ BarChart
49
+ )
50
+ } ,
51
+ components : { BarChart }
52
+ } ) . $mount ( el )
53
+
54
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
55
+
56
+ vm . $destroy ( )
57
+
58
+ vm . $nextTick ( ( ) => {
59
+ vm . $forceUpdate ( )
60
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
61
+ done ( )
62
+ } )
63
+ } )
43
64
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,25 @@ describe('BubbleChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#bubblechartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+
44
+ it ( 'should destroy chart instance' , ( done ) => {
45
+ const vm = new Vue ( {
46
+ render : function ( createElement ) {
47
+ return createElement (
48
+ BubbleChart
49
+ )
50
+ } ,
51
+ components : { BubbleChart }
52
+ } ) . $mount ( el )
53
+
54
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
55
+
56
+ vm . $destroy ( )
57
+
58
+ vm . $nextTick ( ( ) => {
59
+ vm . $forceUpdate ( )
60
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
61
+ done ( )
62
+ } )
63
+ } )
43
64
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,25 @@ describe('DoughnutChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#doughnutchartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+
44
+ it ( 'should destroy chart instance' , ( done ) => {
45
+ const vm = new Vue ( {
46
+ render : function ( createElement ) {
47
+ return createElement (
48
+ DoughnutChart
49
+ )
50
+ } ,
51
+ components : { DoughnutChart }
52
+ } ) . $mount ( el )
53
+
54
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
55
+
56
+ vm . $destroy ( )
57
+
58
+ vm . $nextTick ( ( ) => {
59
+ vm . $forceUpdate ( )
60
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
61
+ done ( )
62
+ } )
63
+ } )
43
64
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,25 @@ describe('LineChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#linechartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+
44
+ it ( 'should destroy chart instance' , ( done ) => {
45
+ const vm = new Vue ( {
46
+ render : function ( createElement ) {
47
+ return createElement (
48
+ LineChart
49
+ )
50
+ } ,
51
+ components : { LineChart }
52
+ } ) . $mount ( el )
53
+
54
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
55
+
56
+ vm . $destroy ( )
57
+
58
+ vm . $nextTick ( ( ) => {
59
+ vm . $forceUpdate ( )
60
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
61
+ done ( )
62
+ } )
63
+ } )
43
64
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,24 @@ describe('PieChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#piechartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+ it ( 'should destroy chart instance' , ( done ) => {
44
+ const vm = new Vue ( {
45
+ render : function ( createElement ) {
46
+ return createElement (
47
+ PieChart
48
+ )
49
+ } ,
50
+ components : { PieChart }
51
+ } ) . $mount ( el )
52
+
53
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
54
+
55
+ vm . $destroy ( )
56
+
57
+ vm . $nextTick ( ( ) => {
58
+ vm . $forceUpdate ( )
59
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
60
+ done ( )
61
+ } )
62
+ } )
43
63
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,25 @@ describe('PolarChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#polarchartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+
44
+ it ( 'should destroy chart instance' , ( done ) => {
45
+ const vm = new Vue ( {
46
+ render : function ( createElement ) {
47
+ return createElement (
48
+ PolarChart
49
+ )
50
+ } ,
51
+ components : { PolarChart }
52
+ } ) . $mount ( el )
53
+
54
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
55
+
56
+ vm . $destroy ( )
57
+
58
+ vm . $nextTick ( ( ) => {
59
+ vm . $forceUpdate ( )
60
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
61
+ done ( )
62
+ } )
63
+ } )
43
64
} )
Original file line number Diff line number Diff line change @@ -40,4 +40,24 @@ describe('RadarChart', () => {
40
40
41
41
expect ( vm . $el . querySelector ( '#rodarchartprop' ) ) . not . to . be . an ( 'undefined' )
42
42
} )
43
+ it ( 'should destroy chart instance' , ( done ) => {
44
+ const vm = new Vue ( {
45
+ render : function ( createElement ) {
46
+ return createElement (
47
+ RadarChart
48
+ )
49
+ } ,
50
+ components : { RadarChart }
51
+ } ) . $mount ( el )
52
+
53
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . not . to . be . null
54
+
55
+ vm . $destroy ( )
56
+
57
+ vm . $nextTick ( ( ) => {
58
+ vm . $forceUpdate ( )
59
+ expect ( vm . $children [ 0 ] . _chart . chart . ctx ) . to . be . null
60
+ done ( )
61
+ } )
62
+ } )
43
63
} )
You can’t perform that action at this time.
0 commit comments