first draft of Model#escape

This commit is contained in:
Jeremy Ashkenas
2010-11-29 12:58:47 -05:00
parent 9994d2bab8
commit 7ae0384120
2 changed files with 32 additions and 2 deletions

View File

@@ -94,6 +94,16 @@ $(document).ready(function() {
equals(doc.get('author'), 'Bill Shakespeare');
});
test("Model: escape", function() {
equals(doc.escape('title'), 'The Tempest');
doc.set({audience: 'Bill & Bob'});
equals(doc.escape('audience'), 'Bill & Bob');
doc.set({audience: 'Tim > Joan'});
equals(doc.escape('audience'), 'Tim > Joan');
doc.unset('audience');
equals(doc.escape('audience'), '');
});
test("Model: set and unset", function() {
attrs = { 'foo': 1, 'bar': 2, 'baz': 3};
a = new Backbone.Model(attrs);
@@ -151,7 +161,7 @@ $(document).ready(function() {
model.change();
equals(model.get('name'), 'Rob');
});
test("Model: save within change event", function () {
var model = new Backbone.Model({firstName : "Taylor", lastName: "Swift"});
model.bind('change', function () {