promised-models
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -94,2 +94,5 @@ | ||
get: function () { | ||
if (arguments.length > 0) { | ||
throw new Error('Attribute.get() supports no arguments'); | ||
} | ||
return this.value; | ||
@@ -96,0 +99,0 @@ }, |
@@ -250,3 +250,3 @@ /** | ||
* @param {Function} cb | ||
* @param {*} [ctx] [description] | ||
* @param {*} [ctx] | ||
*/ | ||
@@ -407,3 +407,3 @@ un: function (attribute, event, cb, ctx) { | ||
* @param {Function} cb | ||
* @param {*} [ctx] [description] | ||
* @param {*} [ctx] | ||
*/ | ||
@@ -410,0 +410,0 @@ _callEventEmitter: function (method, attribute, event, cb, ctx) { |
@@ -82,2 +82,11 @@ /** | ||
/** | ||
* @override | ||
*/ | ||
set: function (value) { | ||
if (!this.isEqual(value)) { | ||
this.value = this.parse(value); | ||
this.emitListChange(); | ||
} | ||
}, | ||
@@ -84,0 +93,0 @@ /** |
{ | ||
"description": "promise based, typed attributes, nested models and collections", | ||
"name": "promised-models", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"repository": "git@github.com:delfrrr/promised-models.git", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -12,2 +12,3 @@ var expect = require('chai').expect; | ||
beforeEach(function () { | ||
console.log('beforeEach'); | ||
model = new Model({ | ||
@@ -151,12 +152,31 @@ nested: { | ||
}); | ||
it('should not trigger event on removed model', function (done) { | ||
it('should not trigger event on removed model', function () { | ||
var changeCall = 0; | ||
model.on('change', function () { | ||
done(); | ||
changeCall++; | ||
expect(changeCall).to.be.below(2); | ||
}); | ||
var nestedModel = model.get('collection').unshift(); | ||
model.ready().then(function () { | ||
var nestedModel = model.get('collection').shift(); | ||
return model.ready().then(function () { | ||
expect(changeCall).to.be.equal(1); | ||
nestedModel.set('a', 'a-10'); | ||
return nestedModel.ready(); | ||
}); | ||
}); | ||
it('should be trigered for models added through .set', function (done) { | ||
var nestedModel = new NestedModel({a: 'a-3'}); | ||
nestedModel.ready().then(function () { | ||
model.set({ | ||
collection: [nestedModel] | ||
}); | ||
return model.ready(); | ||
}).then(function () { | ||
model.on('change', function () { | ||
done(); | ||
}); | ||
nestedModel.set('a', 'a-10'); | ||
}).done(); | ||
}); | ||
}); | ||
@@ -163,0 +183,0 @@ |
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
87862
2222