mirror of
https://github.com/chaijs/chai
synced 2024-11-15 08:17:14 +00:00
Update utility docs
This commit is contained in:
parent
be7a8fcf48
commit
4122ae5db9
4 changed files with 13 additions and 13 deletions
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* Adds a method to the prototype of an object.
|
||||
*
|
||||
* utils.addMethod(chai.Assertion, 'foo', function (str) {
|
||||
* utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.equal(str);
|
||||
* });
|
||||
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* expect(fooStr).to.be.foo('bar');
|
||||
*
|
||||
* @param {Function|Object} context (such as `chai.Assertion.prototype`)
|
||||
* @param {Object} ctx object to which the method is added
|
||||
* @param {String} name of method to add
|
||||
* @param {Function} method function to used for name
|
||||
* @param {Function} method function to be used for name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* Adds a property to the prototype of an object.
|
||||
*
|
||||
* utils.addProperty(chai.Assertion, 'foo', function () {
|
||||
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.instanceof(Foo);
|
||||
* });
|
||||
|
@ -18,9 +18,9 @@
|
|||
*
|
||||
* expect(myFoo).to.be.foo;
|
||||
*
|
||||
* @param {Function|Object} context (such as `chai.Assertion.prototype`)
|
||||
* @param {Object} ctx object to which the property is added
|
||||
* @param {String} name of property to add
|
||||
* @param {Function} getter function to used for name
|
||||
* @param {Function} getter function to be used for name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* # overwriteProperty (ctx, name, fn)
|
||||
* # overwriteMethod (ctx, name, fn)
|
||||
*
|
||||
* Overwites an already existing method and provides
|
||||
* access to previous function. Must return function
|
||||
* to be used for name.
|
||||
*
|
||||
* utils.overwriteMethod(chai.Assertion, 'equal', function (_super) {
|
||||
* utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
|
||||
* return function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
|
@ -26,9 +26,9 @@
|
|||
*
|
||||
* expect(myFoo).to.equal('bar');
|
||||
*
|
||||
* @param {Function|Object} context chai.Assertion || chai.Assertion.prototype
|
||||
* @param {Object} ctx object whose method is to be overwritten
|
||||
* @param {String} name of method to overwrite
|
||||
* @param {Function} method function to be used for name
|
||||
* @param {Function} method function that returns a function to be used for name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* Overwites an already existing property getter and provides
|
||||
* access to previous value. Must return function to use as getter.
|
||||
*
|
||||
* utils.overwriteProperty(chai.Assertion, 'ok', function (_super) {
|
||||
* utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
|
||||
* return function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
|
@ -25,9 +25,9 @@
|
|||
*
|
||||
* expect(myFoo).to.be.ok;
|
||||
*
|
||||
* @param {Function|Object} context chai.Assertion || chai.Assertion.prototype
|
||||
* @param {Object} ctx object whose property is to be overwritten
|
||||
* @param {String} name of property to overwrite
|
||||
* @param {Function} method must return function to be used for name
|
||||
* @param {Function} getter function that returns a getter function to be used for name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue