Skip to content

Commit

Permalink
Merge branch 'master' of github.com:documentcloud/underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Dec 11, 2012
2 parents 15425de + d5c28dc commit bf265d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,16 @@ $(document).ready(function() {
value();
ok(returned == 6 && intercepted == 6, 'can use tapped objects in a chain');
});

test("has", function () {
var obj = {foo: "bar", func: function () {} };
ok (_.has(obj, "foo"), "has() checks that the object has a property.");
ok (_.has(obj, "baz") == false, "has() returns false if the object doesn't have the property.");
ok (_.has(obj, "func"), "has() works for functions too.");
obj.hasOwnProperty = null;
ok (_.has(obj, "foo"), "has() works even when the hasOwnProperty method is deleted.");
child = {};
child.prototype = obj;
ok (_.has(child, "foo") == false, "has() does not check the prototype chain for a property.")
});
});
4 changes: 4 additions & 0 deletions underscore-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf265d6

Please sign in to comment.