mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
This reverts commit 51be344717
.
This commit is contained in:
parent
35d669e5bb
commit
d561486b4e
@ -157,7 +157,7 @@ export function clone(source) {
|
||||
}
|
||||
|
||||
if (isObject(source)) {
|
||||
const target = Object.create(source);
|
||||
const target = {};
|
||||
const keys = Object.keys(source);
|
||||
const klen = keys.length;
|
||||
let k = 0;
|
||||
|
@ -316,27 +316,6 @@ describe('Chart.helpers.core', function() {
|
||||
expect(output.o).not.toBe(o0);
|
||||
expect(output.o.a).not.toBe(a1);
|
||||
});
|
||||
it('should preserve prototype of objects', function() {
|
||||
// https://github.com/chartjs/Chart.js/issues/7340
|
||||
class MyConfigObject {
|
||||
constructor(s) {
|
||||
this._s = s;
|
||||
}
|
||||
func() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
var original = new MyConfigObject('something');
|
||||
var output = helpers.merge({}, {
|
||||
plugins: [{
|
||||
test: original
|
||||
}]
|
||||
});
|
||||
var clone = output.plugins[0].test;
|
||||
expect(clone).toBeInstanceOf(MyConfigObject);
|
||||
expect(clone).toEqual(original);
|
||||
expect(clone === original).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('mergeIf', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user