Added a jsdoc example for withContext()
Fixes jasmine/jasmine.github.io#166
This commit is contained in:
@@ -3667,19 +3667,24 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some context for an {@link expect}
|
||||
* Add some context to be included in matcher failures for an
|
||||
* {@link expect|expectation}, so that it can be more easily distinguished
|
||||
* from similar expectations.
|
||||
* @function
|
||||
* @name matchers#withContext
|
||||
* @since 3.3.0
|
||||
* @param {String} message - Additional context to show when the matcher fails
|
||||
* @return {matchers}
|
||||
* @example
|
||||
* expect(things[0]).withContext('thing 0').toEqual('a');
|
||||
* expect(things[1]).withContext('thing 1').toEqual('b');
|
||||
*/
|
||||
Expectation.prototype.withContext = function withContext(message) {
|
||||
return addFilter(this, new ContextAddingFilter(message));
|
||||
};
|
||||
|
||||
/**
|
||||
* Invert the matcher following this {@link expect}
|
||||
* Invert the matcher following this {@link expect|expectation}
|
||||
* @member
|
||||
* @name matchers#not
|
||||
* @since 1.3.0
|
||||
|
||||
@@ -16,19 +16,24 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some context for an {@link expect}
|
||||
* Add some context to be included in matcher failures for an
|
||||
* {@link expect|expectation}, so that it can be more easily distinguished
|
||||
* from similar expectations.
|
||||
* @function
|
||||
* @name matchers#withContext
|
||||
* @since 3.3.0
|
||||
* @param {String} message - Additional context to show when the matcher fails
|
||||
* @return {matchers}
|
||||
* @example
|
||||
* expect(things[0]).withContext('thing 0').toEqual('a');
|
||||
* expect(things[1]).withContext('thing 1').toEqual('b');
|
||||
*/
|
||||
Expectation.prototype.withContext = function withContext(message) {
|
||||
return addFilter(this, new ContextAddingFilter(message));
|
||||
};
|
||||
|
||||
/**
|
||||
* Invert the matcher following this {@link expect}
|
||||
* Invert the matcher following this {@link expect|expectation}
|
||||
* @member
|
||||
* @name matchers#not
|
||||
* @since 1.3.0
|
||||
|
||||
Reference in New Issue
Block a user