Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos and remove trailing whitespaces #1042

Merged
merged 1 commit into from Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
158 changes: 79 additions & 79 deletions chai.js

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions lib/chai/core/assertions.js
Expand Up @@ -149,7 +149,7 @@ module.exports = function (chai, _) {
* Object.prototype.b = 2;
*
* expect({a: 1}).to.have.own.property('a');
* expect({a: 1}).to.have.property('b').but.not.own.property('b');
* expect({a: 1}).to.have.property('b').but.not.own.property('b');
*
* expect({a: 1}).to.own.include({a: 1});
* expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2});
Expand Down Expand Up @@ -282,7 +282,7 @@ module.exports = function (chai, _) {
* expect(1, 'nooo why fail??').to.be.a('string');
*
* `.a` can also be used as a language chain to improve the readability of
* your assertions.
* your assertions.
*
* expect({b: 2}).to.have.a.property('b');
*
Expand Down Expand Up @@ -396,7 +396,7 @@ module.exports = function (chai, _) {
*
* expect('foobar').to.not.include('taco');
* expect([1, 2, 3]).to.not.include(4);
*
*
* However, it's dangerous to negate `.include` when the target is an object.
* The problem is that it creates uncertain expectations by asserting that the
* target object doesn't have all of `val`'s key/value pairs but may or may
Expand Down Expand Up @@ -469,7 +469,7 @@ module.exports = function (chai, _) {

function include (val, msg) {
if (msg) flag(this, 'message', msg);

var obj = flag(this, 'object')
, objType = _.type(obj).toLowerCase()
, flagMsg = flag(this, 'message')
Expand Down Expand Up @@ -542,17 +542,17 @@ module.exports = function (chai, _) {
var props = Object.keys(val)
, firstErr = null
, numErrs = 0;

props.forEach(function (prop) {
var propAssertion = new Assertion(obj);
_.transferFlags(this, propAssertion, true);
flag(propAssertion, 'lockSsfi', true);

if (!negate || props.length === 1) {
propAssertion.property(prop, val[prop]);
return;
}

try {
propAssertion.property(prop, val[prop]);
} catch (err) {
Expand All @@ -563,7 +563,7 @@ module.exports = function (chai, _) {
numErrs++;
}
}, this);

// When validating .not.include with multiple properties, we only want
// to throw an assertion error if all of the properties are included,
// in which case we throw the first property assertion error that we
Expand Down Expand Up @@ -975,7 +975,7 @@ module.exports = function (chai, _) {
*
* expect(1).to.equal(1);
* expect('foo').to.equal('foo');
*
*
* Add `.deep` earlier in the chain to use deep equality instead. See the
* `deep-eql` project page for info on the deep equality algorithm:
* https://github.com/chaijs/deep-eql.
Expand Down Expand Up @@ -1148,7 +1148,7 @@ module.exports = function (chai, _) {
if (doLength) {
new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
}

if (!doLength && (objType === 'date' && nType !== 'date')) {
errorMessage = msgPrefix + 'the argument to above must be a date';
} else if (nType !== 'number' && (doLength || objType === 'number')) {
Expand Down Expand Up @@ -1437,7 +1437,7 @@ module.exports = function (chai, _) {
if (doLength) {
new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
}

if (!doLength && (objType === 'date' && nType !== 'date')) {
errorMessage = msgPrefix + 'the argument to most must be a date';
} else if (nType !== 'number' && (doLength || objType === 'number')) {
Expand Down Expand Up @@ -1674,7 +1674,7 @@ module.exports = function (chai, _) {
*
* expect({a: 1}).to.have.own.property('a');
* expect({a: 1}).to.have.own.property('a', 1);
* expect({a: 1}).to.have.property('b').but.not.own.property('b');
* expect({a: 1}).to.have.property('b').but.not.own.property('b');
*
* `.deep` and `.own` can be combined.
*
Expand All @@ -1701,7 +1701,7 @@ module.exports = function (chai, _) {
* Add `.not` earlier in the chain to negate `.property`.
*
* expect({a: 1}).to.not.have.property('b');
*
*
* However, it's dangerous to negate `.property` when providing `val`. The
* problem is that it creates uncertain expectations by asserting that the
* target either doesn't have a property with the given key `name`, or that it
Expand Down Expand Up @@ -1739,7 +1739,7 @@ module.exports = function (chai, _) {
*
* // Not recommended
* expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??');
*
*
* The above assertion isn't the same thing as not providing `val`. Instead,
* it's asserting that the target object has a `b` property that's equal to
* `undefined`.
Expand Down Expand Up @@ -1858,7 +1858,7 @@ module.exports = function (chai, _) {
* Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`.
*
* expect({a: 1}).to.not.have.ownPropertyDescriptor('b');
*
*
* However, it's dangerous to negate `.ownPropertyDescriptor` when providing
* a `descriptor`. The problem is that it creates uncertain expectations by
* asserting that the target either doesn't have a property descriptor with
Expand Down Expand Up @@ -1929,7 +1929,7 @@ module.exports = function (chai, _) {
* writable: true,
* value: 2,
* });
*
*
* // Recommended
* expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b');
*
Expand Down Expand Up @@ -2146,7 +2146,7 @@ module.exports = function (chai, _) {
* ### .keys(key1[, key2[, ...]])
*
* Asserts that the target object, array, map, or set has the given keys. Only
* the target's own inherited properties are included in the search.
* the target's own inherited properties are included in the search.
*
* When the target is an object or array, keys can be provided as one or more
* string arguments, a single array argument, or a single object argument. In
Expand Down Expand Up @@ -2381,7 +2381,7 @@ module.exports = function (chai, _) {
*
* When no arguments are provided, `.throw` invokes the target function and
* asserts that an error is thrown.
*
*
* var badFn = function () { throw new TypeError('Illegal salmon!'); };
*
* expect(badFn).to.throw();
Expand Down Expand Up @@ -2433,11 +2433,11 @@ module.exports = function (chai, _) {
* expect(badFn).to.throw(err, /salmon/);
*
* Add `.not` earlier in the chain to negate `.throw`.
*
*
* var goodFn = function () {};
*
* expect(goodFn).to.not.throw();
*
*
* However, it's dangerous to negate `.throw` when providing any arguments.
* The problem is that it creates uncertain expectations by asserting that the
* target either doesn't throw an error, or that it throws an error but of a
Expand Down Expand Up @@ -2785,7 +2785,7 @@ module.exports = function (chai, _) {
* first argument, and asserts that the value returned is truthy.
*
* expect(1).to.satisfy(function(num) {
* return num > 0;
* return num > 0;
* });
*
* Add `.not` earlier in the chain to negate `.satisfy`.
Expand Down Expand Up @@ -3254,7 +3254,7 @@ module.exports = function (chai, _) {
*
* expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended
* expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended
*
*
* When the subject is expected to stay the same, it's often best to assert
* exactly that.
*
Expand Down Expand Up @@ -3351,7 +3351,7 @@ module.exports = function (chai, _) {
*
* When two arguments are provided, `.decrease` asserts that the value of the
* given object `subject`'s `prop` property is lesser after invoking the
* target function compared to beforehand.
* target function compared to beforehand.
*
* var myObj = {val: 1}
* , subtractTwo = function () { myObj.val -= 2; };
Expand All @@ -3373,7 +3373,7 @@ module.exports = function (chai, _) {
*
* expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended
* expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended
*
*
* When the subject is expected to stay the same, it's often best to assert
* exactly that.
*
Expand Down