@@ -50,21 +50,20 @@ describe('Chart.DatasetController', function() {
50
50
} ]
51
51
}
52
52
} ) ;
53
-
53
+
54
54
chart . data . datasets [ 0 ] . data = Object . freeze ( [ 5 , 4 , 3 , 2 , 1 , 0 ] ) ;
55
55
chart . update ( ) ;
56
-
56
+
57
57
// Tests that the unlisten path also works for frozen objects
58
58
chart . destroy ( ) ;
59
59
}
60
-
60
+
61
61
expect ( createChart ) . not . toThrow ( ) ;
62
62
} ) ;
63
63
64
64
it ( 'should handle a sealed data object' , function ( ) {
65
65
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 ] ) ;
68
67
var chart = acquireChart ( {
69
68
type : 'line' ,
70
69
data : {
@@ -73,23 +72,20 @@ describe('Chart.DatasetController', function() {
73
72
} ]
74
73
}
75
74
} ) ;
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 ] ) ;
80
77
chart . update ( ) ;
81
-
78
+
82
79
// Tests that the unlisten path also works for frozen objects
83
80
chart . destroy ( ) ;
84
81
}
85
-
82
+
86
83
expect ( createChart ) . not . toThrow ( ) ;
87
84
} ) ;
88
85
89
86
it ( 'should handle an unextendable data object' , function ( ) {
90
87
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 ] ) ;
93
89
var chart = acquireChart ( {
94
90
type : 'line' ,
95
91
data : {
@@ -98,16 +94,14 @@ describe('Chart.DatasetController', function() {
98
94
} ]
99
95
}
100
96
} ) ;
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 ] ) ;
105
99
chart . update ( ) ;
106
-
100
+
107
101
// Tests that the unlisten path also works for frozen objects
108
102
chart . destroy ( ) ;
109
103
}
110
-
104
+
111
105
expect ( createChart ) . not . toThrow ( ) ;
112
106
} ) ;
113
107
} ) ;
0 commit comments