Break the reference to the options of the Class prototype (#7459)

* Break the reference to the options of the Class prototype

* Refactor test and .setOptions

* Revert: Merge https://github.com/Leaflet/Leaflet into class_options
This commit is contained in:
Falke Design
2021-12-02 19:02:49 +01:00
committed by GitHub
parent 30d91b1769
commit a340c086c2
2 changed files with 8 additions and 0 deletions

View File

@ -154,6 +154,12 @@ describe("Class", function () {
expect(props.options).to.be(opts);
});
it("prevents change of prototype options", function () {
var Klass = L.Class.extend({options: {}});
var instance = new Klass();
expect(Klass.prototype.options).to.not.be(instance.options);
});
it("adds constructor hooks correctly", function () {
var spy1 = sinon.spy();