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() {