mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
first draft of Model#escape
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user