spec/javascripts/backbone-nested-attributes/ModelSpec.js in backbone-nested-attributes-0.4.2 vs spec/javascripts/backbone-nested-attributes/ModelSpec.js in backbone-nested-attributes-0.4.3
- old
+ new
@@ -86,10 +86,20 @@
expect(author).toBeAnInstanceOf(Person)
expect(author.get('name')).toEqual('Jon Snow')
})
+ it('pass options to original set', function (done) {
+ var called = false
+ model.on('change:title', function () { called = true })
+ model.set('title', 'My Title', { silent: true })
+ expect(called).toBeFalsy()
+
+ model.set({title: 'My New Title'}, { silent: true })
+ expect(called).toBeFalsy()
+ });
+
describe("passing a model to the relation attribute", function() {
beforeEach(function() {
author = new Person({ name: 'Jon Snow' })
model = new Post
})
@@ -669,13 +679,10 @@
describe("after clearing the parent model", function() {
it("is not serialized on the relation", function() {
model.get('comments').remove(comment)
model.clear()
- expect(model.toJSON({ nested: true })).toEqual({
- title: undefined,
- comments_attributes: []
- })
+ expect(model.toJSON({ nested: true })).toEqual({})
})
})
})
})
})