Improved jsdocs for asymmetric equality testers
This commit is contained in:
@@ -398,7 +398,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
||||||
* @name jasmine.any
|
* @name jasmine.any
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
@@ -410,7 +410,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
||||||
* @name jasmine.anything
|
* @name jasmine.anything
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -421,7 +421,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is `true` or anything truthy.
|
* that will succeed if the actual value being compared is `true` or anything truthy.
|
||||||
* @name jasmine.truthy
|
* @name jasmine.truthy
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -432,7 +432,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
||||||
* @name jasmine.falsy
|
* @name jasmine.falsy
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -443,7 +443,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is empty.
|
* that will succeed if the actual value being compared is empty.
|
||||||
* @name jasmine.empty
|
* @name jasmine.empty
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -454,7 +454,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is not empty.
|
* that will succeed if the actual value being compared is not empty.
|
||||||
* @name jasmine.notEmpty
|
* @name jasmine.notEmpty
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -465,7 +465,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared contains at least the keys and values.
|
* that will succeed if the actual value being compared contains at least the keys and values.
|
||||||
* @name jasmine.objectContaining
|
* @name jasmine.objectContaining
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
@@ -477,7 +477,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
||||||
* @name jasmine.stringMatching
|
* @name jasmine.stringMatching
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -489,7 +489,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
||||||
* @name jasmine.stringContaining
|
* @name jasmine.stringContaining
|
||||||
* @function
|
* @function
|
||||||
@@ -500,7 +500,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
||||||
* @name jasmine.arrayContaining
|
* @name jasmine.arrayContaining
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -512,7 +512,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
||||||
* @name jasmine.arrayWithExactContents
|
* @name jasmine.arrayWithExactContents
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
@@ -524,7 +524,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
||||||
* with at least one key/value pair in the actual value being compared
|
* with at least one key/value pair in the actual value being compared
|
||||||
* @name jasmine.mapContaining
|
* @name jasmine.mapContaining
|
||||||
@@ -537,7 +537,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if every item in the sample passes the deep equality comparison
|
* that will succeed if every item in the sample passes the deep equality comparison
|
||||||
* with at least one item in the actual value being compared
|
* with at least one item in the actual value being compared
|
||||||
* @name jasmine.setContaining
|
* @name jasmine.setContaining
|
||||||
@@ -5608,9 +5608,33 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|||||||
/**
|
/**
|
||||||
* @interface AsymmetricEqualityTester
|
* @interface AsymmetricEqualityTester
|
||||||
* @classdesc An asymmetric equality tester is an object that can match multiple
|
* @classdesc An asymmetric equality tester is an object that can match multiple
|
||||||
* objects. Examples include jasmine.any() and jasmine.stringMatching().
|
* objects. Examples include jasmine.any() and jasmine.stringMatching(). Jasmine
|
||||||
* User-defined asymmetric equality testers can also be defined and used in
|
* includes a number of built-in asymmetric equality testers, such as
|
||||||
* expectations.
|
* {@link jasmine.objectContaining}. User-defined asymmetric equality testers are
|
||||||
|
* also supported.
|
||||||
|
*
|
||||||
|
* Asymmetric equality testers work with any matcher, including user-defined
|
||||||
|
* custom matchers, that uses {@link MatchersUtil#equals} or
|
||||||
|
* {@link MatchersUtil#contains}.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* function numberDivisibleBy(divisor) {
|
||||||
|
* return {
|
||||||
|
* asymmetricMatch: function(n) {
|
||||||
|
* return typeof n === 'number' && n % divisor === 0;
|
||||||
|
* },
|
||||||
|
* jasmineToString: function() {
|
||||||
|
* return `<a number divisible by ${divisor}>`;
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var actual = {
|
||||||
|
* n: 2,
|
||||||
|
* otherFields: "don't care"
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* expect(actual).toEqual(jasmine.objectContaining({n: numberDivisibleBy(2)}));
|
||||||
* @see custom_asymmetric_equality_testers
|
* @see custom_asymmetric_equality_testers
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
* that will succeed if the actual value being compared is an instance of the specified class/constructor.
|
||||||
* @name jasmine.any
|
* @name jasmine.any
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
@@ -241,7 +241,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
* that will succeed if the actual value being compared is not `null` and not `undefined`.
|
||||||
* @name jasmine.anything
|
* @name jasmine.anything
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -252,7 +252,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is `true` or anything truthy.
|
* that will succeed if the actual value being compared is `true` or anything truthy.
|
||||||
* @name jasmine.truthy
|
* @name jasmine.truthy
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -263,7 +263,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
* that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
|
||||||
* @name jasmine.falsy
|
* @name jasmine.falsy
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -274,7 +274,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is empty.
|
* that will succeed if the actual value being compared is empty.
|
||||||
* @name jasmine.empty
|
* @name jasmine.empty
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -285,7 +285,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared is not empty.
|
* that will succeed if the actual value being compared is not empty.
|
||||||
* @name jasmine.notEmpty
|
* @name jasmine.notEmpty
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
@@ -296,7 +296,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value being compared contains at least the keys and values.
|
* that will succeed if the actual value being compared contains at least the keys and values.
|
||||||
* @name jasmine.objectContaining
|
* @name jasmine.objectContaining
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
@@ -308,7 +308,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
* that will succeed if the actual value is a `String` that matches the `RegExp` or `String`.
|
||||||
* @name jasmine.stringMatching
|
* @name jasmine.stringMatching
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -320,7 +320,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
* that will succeed if the actual value is a `String` that contains the specified `String`.
|
||||||
* @name jasmine.stringContaining
|
* @name jasmine.stringContaining
|
||||||
* @function
|
* @function
|
||||||
@@ -331,7 +331,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.
|
||||||
* @name jasmine.arrayContaining
|
* @name jasmine.arrayContaining
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
@@ -343,7 +343,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
||||||
* @name jasmine.arrayWithExactContents
|
* @name jasmine.arrayWithExactContents
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
@@ -355,7 +355,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
* that will succeed if every key/value pair in the sample passes the deep equality comparison
|
||||||
* with at least one key/value pair in the actual value being compared
|
* with at least one key/value pair in the actual value being compared
|
||||||
* @name jasmine.mapContaining
|
* @name jasmine.mapContaining
|
||||||
@@ -368,7 +368,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
* Get an {@link AsymmetricEqualityTester}, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
||||||
* that will succeed if every item in the sample passes the deep equality comparison
|
* that will succeed if every item in the sample passes the deep equality comparison
|
||||||
* with at least one item in the actual value being compared
|
* with at least one item in the actual value being compared
|
||||||
* @name jasmine.setContaining
|
* @name jasmine.setContaining
|
||||||
|
|||||||
@@ -659,9 +659,33 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|||||||
/**
|
/**
|
||||||
* @interface AsymmetricEqualityTester
|
* @interface AsymmetricEqualityTester
|
||||||
* @classdesc An asymmetric equality tester is an object that can match multiple
|
* @classdesc An asymmetric equality tester is an object that can match multiple
|
||||||
* objects. Examples include jasmine.any() and jasmine.stringMatching().
|
* objects. Examples include jasmine.any() and jasmine.stringMatching(). Jasmine
|
||||||
* User-defined asymmetric equality testers can also be defined and used in
|
* includes a number of built-in asymmetric equality testers, such as
|
||||||
* expectations.
|
* {@link jasmine.objectContaining}. User-defined asymmetric equality testers are
|
||||||
|
* also supported.
|
||||||
|
*
|
||||||
|
* Asymmetric equality testers work with any matcher, including user-defined
|
||||||
|
* custom matchers, that uses {@link MatchersUtil#equals} or
|
||||||
|
* {@link MatchersUtil#contains}.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* function numberDivisibleBy(divisor) {
|
||||||
|
* return {
|
||||||
|
* asymmetricMatch: function(n) {
|
||||||
|
* return typeof n === 'number' && n % divisor === 0;
|
||||||
|
* },
|
||||||
|
* jasmineToString: function() {
|
||||||
|
* return `<a number divisible by ${divisor}>`;
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var actual = {
|
||||||
|
* n: 2,
|
||||||
|
* otherFields: "don't care"
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* expect(actual).toEqual(jasmine.objectContaining({n: numberDivisibleBy(2)}));
|
||||||
* @see custom_asymmetric_equality_testers
|
* @see custom_asymmetric_equality_testers
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user