can-define
Advanced tools
Comparing version 2.6.3 to 2.6.4
@@ -1539,1 +1539,18 @@ var QUnit = require("steal-qunit"); | ||
}); | ||
QUnit.test("setup should be called (#395)", function(){ | ||
var calls = []; | ||
var Base = DefineMap.extend("Base",{ | ||
setup: function(attrs) { | ||
calls.push(this); | ||
return DefineMap.prototype.setup.apply(this, arguments); | ||
} | ||
}); | ||
var Super = Base.extend("Super",{}); | ||
var base = new Base(); | ||
var supa = new Super(); | ||
QUnit.deepEqual(calls,[base, supa], "setup called"); | ||
}); |
@@ -76,2 +76,11 @@ "use strict"; | ||
var sealedSetup = function(props){ | ||
define.setup.call( | ||
this, | ||
props || {}, | ||
this.constructor.seal | ||
); | ||
}; | ||
var DefineMap = Construct.extend("DefineMap",{ | ||
@@ -90,9 +99,6 @@ setup: function(base){ | ||
} | ||
define.defineConfigurableAndNotEnumerable(prototype, "setup", function(props){ | ||
define.setup.call( | ||
this, | ||
props || {}, | ||
this.constructor.seal | ||
); | ||
}); | ||
// If someone provided their own setup, we call that. | ||
if(prototype.setup === DefineMap.prototype.setup) { | ||
define.defineConfigurableAndNotEnumerable(prototype, "setup", sealedSetup); | ||
} | ||
@@ -99,0 +105,0 @@ var _computedGetter = Object.getOwnPropertyDescriptor(prototype, "_computed").get; |
{ | ||
"name": "can-define", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"description": "Create observable objects with JS dot operator compatibility", | ||
@@ -5,0 +5,0 @@ "main": "can-define.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
336503
6372