Merge branch 'FelixRilling-boolean-matcher'
- Merges #1679 from @FelixRilling
This commit is contained in:
@@ -109,6 +109,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toBe',
|
'toBe',
|
||||||
'toBeCloseTo',
|
'toBeCloseTo',
|
||||||
'toBeDefined',
|
'toBeDefined',
|
||||||
|
'toBeFalse',
|
||||||
'toBeFalsy',
|
'toBeFalsy',
|
||||||
'toBeGreaterThan',
|
'toBeGreaterThan',
|
||||||
'toBeGreaterThanOrEqual',
|
'toBeGreaterThanOrEqual',
|
||||||
@@ -118,6 +119,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toBeNegativeInfinity',
|
'toBeNegativeInfinity',
|
||||||
'toBeNull',
|
'toBeNull',
|
||||||
'toBePositiveInfinity',
|
'toBePositiveInfinity',
|
||||||
|
'toBeTrue',
|
||||||
'toBeTruthy',
|
'toBeTruthy',
|
||||||
'toBeUndefined',
|
'toBeUndefined',
|
||||||
'toContain',
|
'toContain',
|
||||||
@@ -4098,6 +4100,27 @@ getJasmineRequireObj().toBeDefined = function() {
|
|||||||
return toBeDefined;
|
return toBeDefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getJasmineRequireObj().toBeFalse = function() {
|
||||||
|
/**
|
||||||
|
* {@link expect} the actual value to be `false`.
|
||||||
|
* @function
|
||||||
|
* @name matchers#toBeFalse
|
||||||
|
* @example
|
||||||
|
* expect(result).toBeFalse();
|
||||||
|
*/
|
||||||
|
function toBeFalse() {
|
||||||
|
return {
|
||||||
|
compare: function(actual) {
|
||||||
|
return {
|
||||||
|
pass: actual === false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toBeFalse;
|
||||||
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().toBeFalsy = function() {
|
getJasmineRequireObj().toBeFalsy = function() {
|
||||||
/**
|
/**
|
||||||
* {@link expect} the actual value to be falsy
|
* {@link expect} the actual value to be falsy
|
||||||
@@ -4318,6 +4341,27 @@ getJasmineRequireObj().toBePositiveInfinity = function(j$) {
|
|||||||
return toBePositiveInfinity;
|
return toBePositiveInfinity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getJasmineRequireObj().toBeTrue = function() {
|
||||||
|
/**
|
||||||
|
* {@link expect} the actual value to be `true`.
|
||||||
|
* @function
|
||||||
|
* @name matchers#toBeTrue
|
||||||
|
* @example
|
||||||
|
* expect(result).toBeTrue();
|
||||||
|
*/
|
||||||
|
function toBeTrue() {
|
||||||
|
return {
|
||||||
|
compare: function(actual) {
|
||||||
|
return {
|
||||||
|
pass: actual === true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toBeTrue;
|
||||||
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().toBeTruthy = function() {
|
getJasmineRequireObj().toBeTruthy = function() {
|
||||||
/**
|
/**
|
||||||
* {@link expect} the actual value to be truthy.
|
* {@link expect} the actual value to be truthy.
|
||||||
|
|||||||
25
spec/core/matchers/toBeFalseSpec.js
Normal file
25
spec/core/matchers/toBeFalseSpec.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
describe("toBeFalse", function() {
|
||||||
|
it("passes for false", function() {
|
||||||
|
var matcher = jasmineUnderTest.matchers.toBeFalse(),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare(false);
|
||||||
|
expect(result.pass).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails for non-false", function() {
|
||||||
|
var matcher = jasmineUnderTest.matchers.toBeFalse(),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare('foo');
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails for falsy", function() {
|
||||||
|
var matcher = jasmineUnderTest.matchers.toBeFalse(),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare(undefined);
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
17
spec/core/matchers/toBeTrueSpec.js
Normal file
17
spec/core/matchers/toBeTrueSpec.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
describe("toBeTrue", function() {
|
||||||
|
it("passes for true", function() {
|
||||||
|
var matcher = jasmineUnderTest.matchers.toBeTrue(),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare(true);
|
||||||
|
expect(result.pass).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails for non-true", function() {
|
||||||
|
var matcher = jasmineUnderTest.matchers.toBeTrue(),
|
||||||
|
result;
|
||||||
|
|
||||||
|
result = matcher.compare('foo');
|
||||||
|
expect(result.pass).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -4,6 +4,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toBe',
|
'toBe',
|
||||||
'toBeCloseTo',
|
'toBeCloseTo',
|
||||||
'toBeDefined',
|
'toBeDefined',
|
||||||
|
'toBeFalse',
|
||||||
'toBeFalsy',
|
'toBeFalsy',
|
||||||
'toBeGreaterThan',
|
'toBeGreaterThan',
|
||||||
'toBeGreaterThanOrEqual',
|
'toBeGreaterThanOrEqual',
|
||||||
@@ -13,6 +14,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|||||||
'toBeNegativeInfinity',
|
'toBeNegativeInfinity',
|
||||||
'toBeNull',
|
'toBeNull',
|
||||||
'toBePositiveInfinity',
|
'toBePositiveInfinity',
|
||||||
|
'toBeTrue',
|
||||||
'toBeTruthy',
|
'toBeTruthy',
|
||||||
'toBeUndefined',
|
'toBeUndefined',
|
||||||
'toContain',
|
'toContain',
|
||||||
|
|||||||
20
src/core/matchers/toBeFalse.js
Normal file
20
src/core/matchers/toBeFalse.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
getJasmineRequireObj().toBeFalse = function() {
|
||||||
|
/**
|
||||||
|
* {@link expect} the actual value to be `false`.
|
||||||
|
* @function
|
||||||
|
* @name matchers#toBeFalse
|
||||||
|
* @example
|
||||||
|
* expect(result).toBeFalse();
|
||||||
|
*/
|
||||||
|
function toBeFalse() {
|
||||||
|
return {
|
||||||
|
compare: function(actual) {
|
||||||
|
return {
|
||||||
|
pass: actual === false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toBeFalse;
|
||||||
|
};
|
||||||
20
src/core/matchers/toBeTrue.js
Normal file
20
src/core/matchers/toBeTrue.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
getJasmineRequireObj().toBeTrue = function() {
|
||||||
|
/**
|
||||||
|
* {@link expect} the actual value to be `true`.
|
||||||
|
* @function
|
||||||
|
* @name matchers#toBeTrue
|
||||||
|
* @example
|
||||||
|
* expect(result).toBeTrue();
|
||||||
|
*/
|
||||||
|
function toBeTrue() {
|
||||||
|
return {
|
||||||
|
compare: function(actual) {
|
||||||
|
return {
|
||||||
|
pass: actual === true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return toBeTrue;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user