Add api docs for .not and .withContext
This commit is contained in:
@@ -2801,10 +2801,25 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add some context for an {@link expect}
|
||||||
|
* @function
|
||||||
|
* @name matchers#withContext
|
||||||
|
* @param {String} message - Additional context to show when the matcher fails
|
||||||
|
* @return {matchers}
|
||||||
|
*/
|
||||||
Expectation.prototype.withContext = function withContext(message) {
|
Expectation.prototype.withContext = function withContext(message) {
|
||||||
return addFilter(this, new ContextAddingFilter(message));
|
return addFilter(this, new ContextAddingFilter(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert the matcher following this {@link expect}
|
||||||
|
* @member
|
||||||
|
* @name matchers#not
|
||||||
|
* @type {matchers}
|
||||||
|
* @example
|
||||||
|
* expect(something).not.toBe(true);
|
||||||
|
*/
|
||||||
Object.defineProperty(Expectation.prototype, 'not', {
|
Object.defineProperty(Expectation.prototype, 'not', {
|
||||||
get: function() {
|
get: function() {
|
||||||
return addFilter(this, syncNegatingFilter);
|
return addFilter(this, syncNegatingFilter);
|
||||||
@@ -2828,10 +2843,27 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add some context for an {@link expectAsync}
|
||||||
|
* @function
|
||||||
|
* @name async-matchers#withContext
|
||||||
|
* @param {String} message - Additional context to show when the async matcher fails
|
||||||
|
* @return {async-matchers}
|
||||||
|
*/
|
||||||
AsyncExpectation.prototype.withContext = function withContext(message) {
|
AsyncExpectation.prototype.withContext = function withContext(message) {
|
||||||
return addFilter(this, new ContextAddingFilter(message));
|
return addFilter(this, new ContextAddingFilter(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert the matcher following this {@link expectAsync}
|
||||||
|
* @member
|
||||||
|
* @name async-matchers#not
|
||||||
|
* @type {async-matchers}
|
||||||
|
* @example
|
||||||
|
* await expectAsync(myPromise).not.toBeResolved();
|
||||||
|
* @example
|
||||||
|
* return expectAsync(myPromise).not.toBeResolved();
|
||||||
|
*/
|
||||||
Object.defineProperty(AsyncExpectation.prototype, 'not', {
|
Object.defineProperty(AsyncExpectation.prototype, 'not', {
|
||||||
get: function() {
|
get: function() {
|
||||||
return addFilter(this, asyncNegatingFilter);
|
return addFilter(this, asyncNegatingFilter);
|
||||||
|
|||||||
@@ -16,10 +16,25 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add some context for an {@link expect}
|
||||||
|
* @function
|
||||||
|
* @name matchers#withContext
|
||||||
|
* @param {String} message - Additional context to show when the matcher fails
|
||||||
|
* @return {matchers}
|
||||||
|
*/
|
||||||
Expectation.prototype.withContext = function withContext(message) {
|
Expectation.prototype.withContext = function withContext(message) {
|
||||||
return addFilter(this, new ContextAddingFilter(message));
|
return addFilter(this, new ContextAddingFilter(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert the matcher following this {@link expect}
|
||||||
|
* @member
|
||||||
|
* @name matchers#not
|
||||||
|
* @type {matchers}
|
||||||
|
* @example
|
||||||
|
* expect(something).not.toBe(true);
|
||||||
|
*/
|
||||||
Object.defineProperty(Expectation.prototype, 'not', {
|
Object.defineProperty(Expectation.prototype, 'not', {
|
||||||
get: function() {
|
get: function() {
|
||||||
return addFilter(this, syncNegatingFilter);
|
return addFilter(this, syncNegatingFilter);
|
||||||
@@ -43,10 +58,27 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add some context for an {@link expectAsync}
|
||||||
|
* @function
|
||||||
|
* @name async-matchers#withContext
|
||||||
|
* @param {String} message - Additional context to show when the async matcher fails
|
||||||
|
* @return {async-matchers}
|
||||||
|
*/
|
||||||
AsyncExpectation.prototype.withContext = function withContext(message) {
|
AsyncExpectation.prototype.withContext = function withContext(message) {
|
||||||
return addFilter(this, new ContextAddingFilter(message));
|
return addFilter(this, new ContextAddingFilter(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invert the matcher following this {@link expectAsync}
|
||||||
|
* @member
|
||||||
|
* @name async-matchers#not
|
||||||
|
* @type {async-matchers}
|
||||||
|
* @example
|
||||||
|
* await expectAsync(myPromise).not.toBeResolved();
|
||||||
|
* @example
|
||||||
|
* return expectAsync(myPromise).not.toBeResolved();
|
||||||
|
*/
|
||||||
Object.defineProperty(AsyncExpectation.prototype, 'not', {
|
Object.defineProperty(AsyncExpectation.prototype, 'not', {
|
||||||
get: function() {
|
get: function() {
|
||||||
return addFilter(this, asyncNegatingFilter);
|
return addFilter(this, asyncNegatingFilter);
|
||||||
|
|||||||
Reference in New Issue
Block a user