From dc880b1d1e07a2b66f6ee9b5cf64c5ae1064458f Mon Sep 17 00:00:00 2001 From: Geoff Schmidt Date: Wed, 7 Mar 2012 01:47:35 -0800 Subject: [PATCH] Additional tests for Meteor._delete --- packages/meteor/helpers.js | 2 ++ packages/meteor/helpers_test.js | 8 ++++++++ packages/tinytest/tinytest.js | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/meteor/helpers.js b/packages/meteor/helpers.js index c358f85b15..a6791ad00d 100644 --- a/packages/meteor/helpers.js +++ b/packages/meteor/helpers.js @@ -37,6 +37,8 @@ _.extend(Meteor, { break; } obj = obj[key]; + if (typeof obj !== "object") + break; stack.push(obj); } diff --git a/packages/meteor/helpers_test.js b/packages/meteor/helpers_test.js index d44120619c..ec5afd3859 100644 --- a/packages/meteor/helpers_test.js +++ b/packages/meteor/helpers_test.js @@ -51,6 +51,14 @@ Tinytest.add("environment - helpers", function (test) { Meteor._delete(x, "a", "b", "c"); test.equal(x, {}); + x = {a: {b: 99}}; + Meteor._delete(x, "a", "b", "c", "d"); + test.equal(x, {}); + + x = {a: {b: 99}}; + Meteor._delete(x, "a", "b", "c", "d", "e", "f"); + test.equal(x, {}); + x = {a: {b: {c: {d: 99}}}, x: 12}; Meteor._delete(x, "a", "b", "c", "d"); test.equal(x, {x: 12}); diff --git a/packages/tinytest/tinytest.js b/packages/tinytest/tinytest.js index da8a3cc09f..606e2f1822 100644 --- a/packages/tinytest/tinytest.js +++ b/packages/tinytest/tinytest.js @@ -42,7 +42,7 @@ _.extend(TestCaseResults.prototype, { var now = (+new Date); debugger; if ((+new Date) - now < 100) - alert("To use this feature, first open the debugger window in your browser."); + alert("To use this feature, first enable your browser's debugger."); } self.stop_at_offset = null; }