From d3d5b24d15f7cd55483fe2b784ab0eb75dcc5732 Mon Sep 17 00:00:00 2001 From: Adi Prasetyo Date: Thu, 23 Nov 2017 23:31:48 +0700 Subject: [PATCH] Revert "Fix #1090" This reverts commit 12a70f4aba61170632a136216492b9083351d121. --- lib/chai/interface/assert.js | 106 ++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/lib/chai/interface/assert.js b/lib/chai/interface/assert.js index 0f5613258..59e5f8b66 100644 --- a/lib/chai/interface/assert.js +++ b/lib/chai/interface/assert.js @@ -1012,24 +1012,24 @@ module.exports = function (chai, util) { /** * ### .nestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the inclusion of a subset of properties in an * object. - * Enables the use of dot- and bracket-notation for referencing nested + * Enables the use of dot- and bracket-notation for referencing nested * properties. * '[]' and '.' in property names can be escaped using double backslashes. - * + * * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); - * + * * @name nestedInclude * @param {Object} haystack * @param {Object} needle * @param {String} message * @namespace Assert - * @api public - */ + * @api public + */ assert.nestedInclude = function (exp, inc, msg) { new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); @@ -1037,24 +1037,24 @@ module.exports = function (chai, util) { /** * ### .notNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an + * + * Asserts that 'haystack' does not include 'needle'. + * Can be used to assert the absence of a subset of properties in an * object. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. + * Enables the use of dot- and bracket-notation for referencing nested + * properties. * '[]' and '.' in property names can be escaped using double backslashes. - * + * * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); - * + * * @name notNestedInclude * @param {Object} haystack * @param {Object} needle * @param {String} message * @namespace Assert - * @api public - */ + * @api public + */ assert.notNestedInclude = function (exp, inc, msg) { new Assertion(exp, msg, assert.notNestedInclude, true) @@ -1063,23 +1063,23 @@ module.exports = function (chai, util) { /** * ### .deepNestedInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an + * Can be used to assert the inclusion of a subset of properties in an * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested + * Enables the use of dot- and bracket-notation for referencing nested * properties. * '[]' and '.' in property names can be escaped using double backslashes. - * + * * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); - * + * * @name deepNestedInclude * @param {Object} haystack * @param {Object} needle * @param {String} message * @namespace Assert - * @api public + * @api public */ assert.deepNestedInclude = function(exp, inc, msg) { @@ -1089,23 +1089,23 @@ module.exports = function (chai, util) { /** * ### .notDeepNestedInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an + * Can be used to assert the absence of a subset of properties in an * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested + * Enables the use of dot- and bracket-notation for referencing nested * properties. * '[]' and '.' in property names can be escaped using double backslashes. - * + * * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); - * + * * @name notDeepNestedInclude * @param {Object} haystack * @param {Object} needle * @param {String} message * @namespace Assert - * @api public + * @api public */ assert.notDeepNestedInclude = function(exp, inc, msg) { @@ -1115,13 +1115,13 @@ module.exports = function (chai, util) { /** * ### .ownInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an + * Can be used to assert the inclusion of a subset of properties in an * object while ignoring inherited properties. - * + * * assert.ownInclude({ a: 1 }, { a: 1 }); - * + * * @name ownInclude * @param {Object} haystack * @param {Object} needle @@ -1136,15 +1136,15 @@ module.exports = function (chai, util) { /** * ### .notOwnInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an + * Can be used to assert the absence of a subset of properties in an * object while ignoring inherited properties. - * + * * Object.prototype.b = 2; - * + * * assert.notOwnInclude({ a: 1 }, { b: 2 }); - * + * * @name notOwnInclude * @param {Object} haystack * @param {Object} needle @@ -1159,13 +1159,13 @@ module.exports = function (chai, util) { /** * ### .deepOwnInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an + * Can be used to assert the inclusion of a subset of properties in an * object while ignoring inherited properties and checking for deep equality. - * + * * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); - * + * * @name deepOwnInclude * @param {Object} haystack * @param {Object} needle @@ -1181,13 +1181,13 @@ module.exports = function (chai, util) { /** * ### .notDeepOwnInclude(haystack, needle, [message]) - * + * * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an + * Can be used to assert the absence of a subset of properties in an * object while ignoring inherited properties and checking for deep equality. - * + * * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); - * + * * @name notDeepOwnInclude * @param {Object} haystack * @param {Object} needle @@ -2645,7 +2645,7 @@ module.exports = function (chai, util) { assert.increasesBy = function (fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === 'function') { var tmpMsg = delta; - prop = null; + delta = prop; msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; @@ -2705,8 +2705,9 @@ module.exports = function (chai, util) { assert.increasesButNotBy = function (fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === 'function') { - msg = 'getter function'; - prop = null; + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null; @@ -2766,8 +2767,8 @@ module.exports = function (chai, util) { assert.decreasesBy = function (fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === 'function') { var tmpMsg = delta; + delta = prop; msg = tmpMsg; - prop = null; } else if (arguments.length === 3) { delta = prop; prop = null; @@ -2859,8 +2860,9 @@ module.exports = function (chai, util) { assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) { if (arguments.length === 4 && typeof obj === 'function') { - msg = 'getter function'; - prop= null; + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; } else if (arguments.length === 3) { delta = prop; prop = null;