Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update tests and fix lint issues
  • Loading branch information
etimberg committed Feb 11, 2019
commit 14c18ef72e23f593ff1b51cd30de0d5f5f2ee199
32 changes: 13 additions & 19 deletions test/specs/core.datasetController.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ describe('Chart.DatasetController', function() {
}]
}
});

chart.data.datasets[0].data = Object.freeze([5, 4, 3, 2, 1, 0]);
chart.update();

// Tests that the unlisten path also works for frozen objects
chart.destroy();
}

expect(createChart).not.toThrow();
});

it('should handle a sealed data object', function() {
function createChart() {
var data = [0, 1, 2, 3, 4, 5];
Object.seal(data);
var data = Object.seal([0, 1, 2, 3, 4, 5]);
var chart = acquireChart({
type: 'line',
data: {
Expand All @@ -73,23 +72,20 @@ describe('Chart.DatasetController', function() {
}]
}
});

var data2 = [5, 4, 3, 2, 1, 0];
Object.seal(data2)
chart.data.datasets[0].data = data2;

chart.data.datasets[0].data = Object.seal([5, 4, 3, 2, 1, 0]);
chart.update();

// Tests that the unlisten path also works for frozen objects
chart.destroy();
}

expect(createChart).not.toThrow();
});

it('should handle an unextendable data object', function() {
function createChart() {
var data = [0, 1, 2, 3, 4, 5];
Object.preventExtensions(data);
var data = Object.preventExtensions([0, 1, 2, 3, 4, 5]);
var chart = acquireChart({
type: 'line',
data: {
Expand All @@ -98,16 +94,14 @@ describe('Chart.DatasetController', function() {
}]
}
});

var data2 = [5, 4, 3, 2, 1, 0];
Object.preventExtensions(data2)
chart.data.datasets[0].data = data2;

chart.data.datasets[0].data = Object.preventExtensions([5, 4, 3, 2, 1, 0]);
chart.update();

// Tests that the unlisten path also works for frozen objects
chart.destroy();
}

expect(createChart).not.toThrow();
});
});
Expand Down