Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13283b3

Browse files
committed
Revert "Fix #1090"
This reverts commit 12a70f4.
1 parent 8cf938a commit 13283b3

File tree

1 file changed

+54
-52
lines changed

1 file changed

+54
-52
lines changed

lib/chai/interface/assert.js

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,49 +1012,49 @@ module.exports = function (chai, util) {
10121012

10131013
/**
10141014
* ### .nestedInclude(haystack, needle, [message])
1015-
*
1016-
* Asserts that 'haystack' includes 'needle'.
1017-
* Can be used to assert the inclusion of a subset of properties in an
1015+
*
1016+
* Asserts that 'haystack' includes 'needle'.
1017+
* Can be used to assert the inclusion of a subset of properties in an
10181018
* object.
1019-
* Enables the use of dot- and bracket-notation for referencing nested
1019+
* Enables the use of dot- and bracket-notation for referencing nested
10201020
* properties.
10211021
* '[]' and '.' in property names can be escaped using double backslashes.
1022-
*
1022+
*
10231023
* assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'});
10241024
* assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
1025-
*
1025+
*
10261026
* @name nestedInclude
10271027
* @param {Object} haystack
10281028
* @param {Object} needle
10291029
* @param {String} message
10301030
* @namespace Assert
1031-
* @api public
1032-
*/
1031+
* @api public
1032+
*/
10331033

10341034
assert.nestedInclude = function (exp, inc, msg) {
10351035
new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
10361036
};
10371037

10381038
/**
10391039
* ### .notNestedInclude(haystack, needle, [message])
1040-
*
1041-
* Asserts that 'haystack' does not include 'needle'.
1042-
* Can be used to assert the absence of a subset of properties in an
1040+
*
1041+
* Asserts that 'haystack' does not include 'needle'.
1042+
* Can be used to assert the absence of a subset of properties in an
10431043
* object.
1044-
* Enables the use of dot- and bracket-notation for referencing nested
1045-
* properties.
1044+
* Enables the use of dot- and bracket-notation for referencing nested
1045+
* properties.
10461046
* '[]' and '.' in property names can be escaped using double backslashes.
1047-
*
1047+
*
10481048
* assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'});
10491049
* assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
1050-
*
1050+
*
10511051
* @name notNestedInclude
10521052
* @param {Object} haystack
10531053
* @param {Object} needle
10541054
* @param {String} message
10551055
* @namespace Assert
1056-
* @api public
1057-
*/
1056+
* @api public
1057+
*/
10581058

10591059
assert.notNestedInclude = function (exp, inc, msg) {
10601060
new Assertion(exp, msg, assert.notNestedInclude, true)
@@ -1063,23 +1063,23 @@ module.exports = function (chai, util) {
10631063

10641064
/**
10651065
* ### .deepNestedInclude(haystack, needle, [message])
1066-
*
1066+
*
10671067
* Asserts that 'haystack' includes 'needle'.
1068-
* Can be used to assert the inclusion of a subset of properties in an
1068+
* Can be used to assert the inclusion of a subset of properties in an
10691069
* object while checking for deep equality.
1070-
* Enables the use of dot- and bracket-notation for referencing nested
1070+
* Enables the use of dot- and bracket-notation for referencing nested
10711071
* properties.
10721072
* '[]' and '.' in property names can be escaped using double backslashes.
1073-
*
1073+
*
10741074
* assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}});
10751075
* assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}});
1076-
*
1076+
*
10771077
* @name deepNestedInclude
10781078
* @param {Object} haystack
10791079
* @param {Object} needle
10801080
* @param {String} message
10811081
* @namespace Assert
1082-
* @api public
1082+
* @api public
10831083
*/
10841084

10851085
assert.deepNestedInclude = function(exp, inc, msg) {
@@ -1089,23 +1089,23 @@ module.exports = function (chai, util) {
10891089

10901090
/**
10911091
* ### .notDeepNestedInclude(haystack, needle, [message])
1092-
*
1092+
*
10931093
* Asserts that 'haystack' does not include 'needle'.
1094-
* Can be used to assert the absence of a subset of properties in an
1094+
* Can be used to assert the absence of a subset of properties in an
10951095
* object while checking for deep equality.
1096-
* Enables the use of dot- and bracket-notation for referencing nested
1096+
* Enables the use of dot- and bracket-notation for referencing nested
10971097
* properties.
10981098
* '[]' and '.' in property names can be escaped using double backslashes.
1099-
*
1099+
*
11001100
* assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}})
11011101
* assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
1102-
*
1102+
*
11031103
* @name notDeepNestedInclude
11041104
* @param {Object} haystack
11051105
* @param {Object} needle
11061106
* @param {String} message
11071107
* @namespace Assert
1108-
* @api public
1108+
* @api public
11091109
*/
11101110

11111111
assert.notDeepNestedInclude = function(exp, inc, msg) {
@@ -1115,13 +1115,13 @@ module.exports = function (chai, util) {
11151115

11161116
/**
11171117
* ### .ownInclude(haystack, needle, [message])
1118-
*
1118+
*
11191119
* Asserts that 'haystack' includes 'needle'.
1120-
* Can be used to assert the inclusion of a subset of properties in an
1120+
* Can be used to assert the inclusion of a subset of properties in an
11211121
* object while ignoring inherited properties.
1122-
*
1122+
*
11231123
* assert.ownInclude({ a: 1 }, { a: 1 });
1124-
*
1124+
*
11251125
* @name ownInclude
11261126
* @param {Object} haystack
11271127
* @param {Object} needle
@@ -1136,15 +1136,15 @@ module.exports = function (chai, util) {
11361136

11371137
/**
11381138
* ### .notOwnInclude(haystack, needle, [message])
1139-
*
1139+
*
11401140
* Asserts that 'haystack' includes 'needle'.
1141-
* Can be used to assert the absence of a subset of properties in an
1141+
* Can be used to assert the absence of a subset of properties in an
11421142
* object while ignoring inherited properties.
1143-
*
1143+
*
11441144
* Object.prototype.b = 2;
1145-
*
1145+
*
11461146
* assert.notOwnInclude({ a: 1 }, { b: 2 });
1147-
*
1147+
*
11481148
* @name notOwnInclude
11491149
* @param {Object} haystack
11501150
* @param {Object} needle
@@ -1159,13 +1159,13 @@ module.exports = function (chai, util) {
11591159

11601160
/**
11611161
* ### .deepOwnInclude(haystack, needle, [message])
1162-
*
1162+
*
11631163
* Asserts that 'haystack' includes 'needle'.
1164-
* Can be used to assert the inclusion of a subset of properties in an
1164+
* Can be used to assert the inclusion of a subset of properties in an
11651165
* object while ignoring inherited properties and checking for deep equality.
1166-
*
1166+
*
11671167
* assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
1168-
*
1168+
*
11691169
* @name deepOwnInclude
11701170
* @param {Object} haystack
11711171
* @param {Object} needle
@@ -1181,13 +1181,13 @@ module.exports = function (chai, util) {
11811181

11821182
/**
11831183
* ### .notDeepOwnInclude(haystack, needle, [message])
1184-
*
1184+
*
11851185
* Asserts that 'haystack' includes 'needle'.
1186-
* Can be used to assert the absence of a subset of properties in an
1186+
* Can be used to assert the absence of a subset of properties in an
11871187
* object while ignoring inherited properties and checking for deep equality.
1188-
*
1188+
*
11891189
* assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
1190-
*
1190+
*
11911191
* @name notDeepOwnInclude
11921192
* @param {Object} haystack
11931193
* @param {Object} needle
@@ -2645,7 +2645,7 @@ module.exports = function (chai, util) {
26452645
assert.increasesBy = function (fn, obj, prop, delta, msg) {
26462646
if (arguments.length === 4 && typeof obj === 'function') {
26472647
var tmpMsg = delta;
2648-
prop = null;
2648+
delta = prop;
26492649
msg = tmpMsg;
26502650
} else if (arguments.length === 3) {
26512651
delta = prop;
@@ -2705,8 +2705,9 @@ module.exports = function (chai, util) {
27052705

27062706
assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {
27072707
if (arguments.length === 4 && typeof obj === 'function') {
2708-
msg = 'getter function';
2709-
prop = null;
2708+
var tmpMsg = delta;
2709+
delta = prop;
2710+
msg = tmpMsg;
27102711
} else if (arguments.length === 3) {
27112712
delta = prop;
27122713
prop = null;
@@ -2766,8 +2767,8 @@ module.exports = function (chai, util) {
27662767
assert.decreasesBy = function (fn, obj, prop, delta, msg) {
27672768
if (arguments.length === 4 && typeof obj === 'function') {
27682769
var tmpMsg = delta;
2770+
delta = prop;
27692771
msg = tmpMsg;
2770-
prop = null;
27712772
} else if (arguments.length === 3) {
27722773
delta = prop;
27732774
prop = null;
@@ -2859,8 +2860,9 @@ module.exports = function (chai, util) {
28592860

28602861
assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
28612862
if (arguments.length === 4 && typeof obj === 'function') {
2862-
msg = 'getter function';
2863-
prop= null;
2863+
var tmpMsg = delta;
2864+
delta = prop;
2865+
msg = tmpMsg;
28642866
} else if (arguments.length === 3) {
28652867
delta = prop;
28662868
prop = null;

0 commit comments

Comments
 (0)