Skip to content

Commit

Permalink
Ensure tests run in IE7.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Jun 12, 2012
1 parent 7bcd6ad commit f133f0d
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions test/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,33 @@ $(document).ready(function() {
});

test("Model: has", 10, function() {
var a = new Backbone.Model();
equal(a.has("name"), false);
_([true, "Truth!", 1, false, '', 0]).each(function(value) {
a.set({'name': value});
equal(a.has("name"), true);
});
a.unset('name');
equal(a.has('name'), false);
_([null, undefined]).each(function(value) {
a.set({'name': value});
equal(a.has("name"), false);
var model = new Backbone.Model();

strictEqual(model.has('name'), false);

model.set({
0: 0,
1: 1,
true: true,
false: false,
empty: '',
name: 'name',
null: null,
undefined: undefined
});

strictEqual(model.has('0'), true);
strictEqual(model.has('1'), true);
strictEqual(model.has('true'), true);
strictEqual(model.has('false'), true);
strictEqual(model.has('empty'), true);
strictEqual(model.has('name'), true);

model.unset('name');

strictEqual(model.has('name'), false);
strictEqual(model.has('null'), false);
strictEqual(model.has('undefined'), false);
});

test("Model: set and unset", 8, function() {
Expand Down

0 comments on commit f133f0d

Please sign in to comment.