Skip to content

Commit

Permalink
Test case for undefined options
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeleidus committed Aug 21, 2012
1 parent 460adf5 commit 7f098f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ $(document).ready(function() {
test("objects: defaults", function() {
var result;
var options = {zero: 0, one: 1, empty: "", nan: NaN, string: "string"};
var undefinedOptions;

_.defaults(options, {zero: 1, one: 10, twenty: 20});
equal(options.zero, 0, 'value exists');
Expand All @@ -63,6 +64,9 @@ $(document).ready(function() {
equal(options.empty, "", 'value exists');
ok(_.isNaN(options.nan), "NaN isn't overridden");
equal(options.word, "word", 'new value is added, first one wins');

_.defaults(undefinedOptions, {one: 1});
equal(undefinedOptions.one, 1, 'value exists');
});

test("objects: clone", function() {
Expand Down

0 comments on commit 7f098f4

Please sign in to comment.