Skip to content

Commit

Permalink
docs: fix typos and remove trailing whitespaces (#1042)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonewebdesign authored and keithamus committed Nov 22, 2017
1 parent 6e9bfc1 commit 9a6610e
Show file tree
Hide file tree
Showing 15 changed files with 298 additions and 298 deletions.
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 @@ -281,7 +281,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 @@ -395,7 +395,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 @@ -468,7 +468,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 @@ -541,17 +541,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 @@ -562,7 +562,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 @@ -974,7 +974,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 @@ -1147,7 +1147,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 @@ -1436,7 +1436,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 @@ -1673,7 +1673,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 @@ -1700,7 +1700,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 @@ -1738,7 +1738,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 @@ -1876,7 +1876,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 @@ -1947,7 +1947,7 @@ module.exports = function (chai, _) {
* writable: true,
* value: 2,
* });
*
*
* // Recommended
* expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b');
*
Expand Down Expand Up @@ -2164,7 +2164,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 @@ -2398,7 +2398,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 @@ -2450,11 +2450,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 @@ -2802,7 +2802,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 @@ -3270,7 +3270,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 @@ -3367,7 +3367,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 @@ -3389,7 +3389,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

0 comments on commit 9a6610e

Please sign in to comment.