Commit 0d6d6b1a authored by Nicolas Biri's avatar Nicolas Biri

Fix assignation issue on false

parent 99d32fdc
Pipeline #743 passed with stage
in 42 seconds
......@@ -60,7 +60,7 @@ function Class(name, superClasses, attributes, references) {
})
createAttributes(this, jsmfElement)
createReferences(this, jsmfElement)
_.forEach(attr, (v,k) => this[k] = v)
_.forEach(attr, (v,k) => {this[k] = v})
}
jsmfElement.prototype.conformsTo = function () { return conformsTo(this) }
jsmfElement.prototype.getAssociated = getAssociated
......
......@@ -95,6 +95,13 @@ describe('Class instance', function() {
done()
})
it('doesn\'t stop on false value', function(done) {
const C = new Class('C', undefined, {a: Boolean, b: Number})
const c = new C({a: false, b: 12})
c.should.have.property('b', 12)
done()
})
it('assign wongly typed values on relaxed schema', function(done) {
const Foo = new Class('Foo', [], {test: {type: Number, errorCallback: JSMF.onError.silent}})
const s = new Foo({test: "i'm not a number"})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment