ampersand-state
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -17,4 +17,3 @@ var _ = require('underscore'); | ||
if (attrs) this.set(attrs, _.extend({silent: true, initial: true}, options)); | ||
this.initialize.apply(this, arguments); | ||
if (this.seal) Object.seal(this); | ||
if (options.init !== false) this.initialize.apply(this, arguments); | ||
} | ||
@@ -21,0 +20,0 @@ |
{ | ||
"name": "ampersand-state", | ||
"description": "An observable, extensible state object with derived watchable properties.", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -92,20 +92,2 @@ var tape = require('tape'); | ||
test('should be sealable', function (t) { | ||
definition.seal = true; | ||
var Bar = State.extend(definition); | ||
var bar = new Bar(); | ||
t.throws(function () { | ||
"use strict"; | ||
// detect if strict mode worked | ||
var isStrict = (function () { return !this; })(); | ||
bar.someProperty = 'new'; | ||
// throw type error to be able to test in browsers | ||
// that don't support strict | ||
if (!isStrict) throw TypeError; | ||
}, TypeError, 'Throws exception in strict mode.'); | ||
bar.someOtherProperty = 'something'; | ||
t.ok(!bar.someOtherProperty, 'ignores properties otherwise'); | ||
t.end(); | ||
}); | ||
test('should have default values for properties', function (t) { | ||
@@ -457,16 +439,2 @@ var foo = new Foo({ | ||
test('should be able to bind events even if sealed', function (t) { | ||
var SealedModel = State.extend({seal: true, props: {name: 'string'}}); | ||
var s = new SealedModel({name: 'henrik'}); | ||
t.equal(s.name, 'henrik', 'should have set name'); | ||
s.on('change:name', function () { | ||
t.ok(true, 'event was triggered.'); | ||
}); | ||
s.name = 'superman'; // ridiculous, right? | ||
t.end(); | ||
}); | ||
test('Calling `previous` during change of derived cached property should work', function (t) { | ||
@@ -473,0 +441,0 @@ var foo = new Foo({firstName: 'Henrik', lastName: 'Joreteg'}); |
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
56138
1366