| 109 | describe('inextensible data', function() { |
| 110 | it('should handle a frozen data object', function() { |
| 111 | function createChart() { |
| 112 | var data = Object.freeze([0, 1, 2, 3, 4, 5]); |
| 113 | expect(Object.isExtensible(data)).toBeFalsy(); |
| 114 | |
| 115 | var chart = acquireChart({ |
| 116 | type: 'line', |
| 117 | data: { |
| 118 | datasets: [{ |
| 119 | data: data |
| 120 | }] |
| 121 | } |
| 122 | }); |
| 123 | |
| 124 | var dataset = chart.data.datasets[0]; |
| 125 | dataset.data = Object.freeze([5, 4, 3, 2, 1, 0]); |
| 126 | expect(Object.isExtensible(dataset.data)).toBeFalsy(); |
| 127 | chart.update(); |
| 128 | |
| 129 | // Tests that the unlisten path also works for frozen objects |
| 130 | chart.destroy(); |
| 131 | } |
| 132 | |
| 133 | expect(createChart).not.toThrow(); |
| 134 | }); |