| 88 | describe('inextensible data', function() { |
| 89 | it('should handle a frozen data object', function() { |
| 90 | function createChart() { |
| 91 | var data = Object.freeze([0, 1, 2, 3, 4, 5]); |
| 92 | expect(Object.isExtensible(data)).toBeFalsy(); |
| 93 | |
| 94 | var chart = acquireChart({ |
| 95 | type: 'line', |
| 96 | data: { |
| 97 | datasets: [{ |
| 98 | data: data |
| 99 | }] |
| 100 | } |
| 101 | }); |
| 102 | |
| 103 | var dataset = chart.data.datasets[0]; |
| 104 | dataset.data = Object.freeze([5, 4, 3, 2, 1, 0]); |
| 105 | expect(Object.isExtensible(dataset.data)).toBeFalsy(); |
| 106 | chart.update(); |
| 107 | |
| 108 | // Tests that the unlisten path also works for frozen objects |
| 109 | chart.destroy(); |
| 110 | } |
| 111 | |
| 112 | expect(createChart).not.toThrow(); |
| 113 | }); |