MCPcopy Create free account
hub / github.com/chartjs/Chart.js / createChart

Function createChart

test/specs/core.datasetController.spec.js:109–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

destroyMethod · 0.80
updateMethod · 0.65

Tested by

no test coverage detected