@@ -50,21 +50,20 @@ describe('Chart.DatasetController', function() {
5050 } ]
5151 }
5252 } ) ;
53-
53+
5454 chart . data . datasets [ 0 ] . data = Object . freeze ( [ 5 , 4 , 3 , 2 , 1 , 0 ] ) ;
5555 chart . update ( ) ;
56-
56+
5757 // Tests that the unlisten path also works for frozen objects
5858 chart . destroy ( ) ;
5959 }
60-
60+
6161 expect ( createChart ) . not . toThrow ( ) ;
6262 } ) ;
6363
6464 it ( 'should handle a sealed data object' , function ( ) {
6565 function createChart ( ) {
66- var data = [ 0 , 1 , 2 , 3 , 4 , 5 ] ;
67- Object . seal ( data ) ;
66+ var data = Object . seal ( [ 0 , 1 , 2 , 3 , 4 , 5 ] ) ;
6867 var chart = acquireChart ( {
6968 type : 'line' ,
7069 data : {
@@ -73,23 +72,20 @@ describe('Chart.DatasetController', function() {
7372 } ]
7473 }
7574 } ) ;
76-
77- var data2 = [ 5 , 4 , 3 , 2 , 1 , 0 ] ;
78- Object . seal ( data2 )
79- chart . data . datasets [ 0 ] . data = data2 ;
75+
76+ chart . data . datasets [ 0 ] . data = Object . seal ( [ 5 , 4 , 3 , 2 , 1 , 0 ] ) ;
8077 chart . update ( ) ;
81-
78+
8279 // Tests that the unlisten path also works for frozen objects
8380 chart . destroy ( ) ;
8481 }
85-
82+
8683 expect ( createChart ) . not . toThrow ( ) ;
8784 } ) ;
8885
8986 it ( 'should handle an unextendable data object' , function ( ) {
9087 function createChart ( ) {
91- var data = [ 0 , 1 , 2 , 3 , 4 , 5 ] ;
92- Object . preventExtensions ( data ) ;
88+ var data = Object . preventExtensions ( [ 0 , 1 , 2 , 3 , 4 , 5 ] ) ;
9389 var chart = acquireChart ( {
9490 type : 'line' ,
9591 data : {
@@ -98,16 +94,14 @@ describe('Chart.DatasetController', function() {
9894 } ]
9995 }
10096 } ) ;
101-
102- var data2 = [ 5 , 4 , 3 , 2 , 1 , 0 ] ;
103- Object . preventExtensions ( data2 )
104- chart . data . datasets [ 0 ] . data = data2 ;
97+
98+ chart . data . datasets [ 0 ] . data = Object . preventExtensions ( [ 5 , 4 , 3 , 2 , 1 , 0 ] ) ;
10599 chart . update ( ) ;
106-
100+
107101 // Tests that the unlisten path also works for frozen objects
108102 chart . destroy ( ) ;
109103 }
110-
104+
111105 expect ( createChart ) . not . toThrow ( ) ;
112106 } ) ;
113107 } ) ;
0 commit comments