Update dist.
This commit is contained in:
parent
49f295690a
commit
7721f47f59
|
@ -1001,10 +1001,11 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
||||||
* @param actual
|
* @param actual
|
||||||
* @param {jasmine.Spec} spec
|
* @param {jasmine.Spec} spec
|
||||||
*/
|
*/
|
||||||
jasmine.Matchers = function(env, actual, spec) {
|
jasmine.Matchers = function(env, actual, spec, opt_isNot) {
|
||||||
this.env = env;
|
this.env = env;
|
||||||
this.actual = actual;
|
this.actual = actual;
|
||||||
this.spec = spec;
|
this.spec = spec;
|
||||||
|
this.isNot = opt_isNot || false;
|
||||||
this.reportWasCalled_ = false;
|
this.reportWasCalled_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1014,8 +1015,12 @@ jasmine.Matchers.pp = function(str) {
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||||
// todo first: report deprecation warning [xw]
|
// todo: report a deprecation warning [xw]
|
||||||
// todo later: throw new Error("As of jasmine 0.xx, custom matchers must be implemented differently -- please see jasmine docs");
|
|
||||||
|
if (this.isNot) {
|
||||||
|
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
|
||||||
|
}
|
||||||
|
|
||||||
this.reportWasCalled_ = true;
|
this.reportWasCalled_ = true;
|
||||||
var expectationResult = new jasmine.ExpectationResult({
|
var expectationResult = new jasmine.ExpectationResult({
|
||||||
passed: result,
|
passed: result,
|
||||||
|
@ -1038,15 +1043,23 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
|
||||||
return function() {
|
return function() {
|
||||||
var matcherArgs = jasmine.util.argsToArray(arguments);
|
var matcherArgs = jasmine.util.argsToArray(arguments);
|
||||||
var result = matcherFunction.apply(this, arguments);
|
var result = matcherFunction.apply(this, arguments);
|
||||||
|
|
||||||
|
if (this.isNot) {
|
||||||
|
result = !result;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.reportWasCalled_) return result;
|
if (this.reportWasCalled_) return result;
|
||||||
|
|
||||||
var message;
|
var message;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
if (this.message) {
|
if (this.message) {
|
||||||
message = this.message.apply(this, arguments);
|
message = this.message.apply(this, arguments);
|
||||||
|
if (jasmine.isArray_(message)) {
|
||||||
|
message = message[this.isNot ? 1 : 0];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
|
var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
|
||||||
message = "Expected " + jasmine.pp(this.actual) + " " + englishyPredicate;
|
message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
|
||||||
if (matcherArgs.length > 0) {
|
if (matcherArgs.length > 0) {
|
||||||
for (var i = 0; i < matcherArgs.length; i++) {
|
for (var i = 0; i < matcherArgs.length; i++) {
|
||||||
if (i > 0) message += ",";
|
if (i > 0) message += ",";
|
||||||
|
@ -1818,7 +1831,9 @@ jasmine.Spec.prototype.addMatcherResult = function(result) {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.expect = function(actual) {
|
jasmine.Spec.prototype.expect = function(actual) {
|
||||||
return new (this.getMatchersClass_())(this.env, actual, this);
|
var positive = new (this.getMatchersClass_())(this.env, actual, this);
|
||||||
|
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
|
||||||
|
return positive;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.waits = function(timeout) {
|
jasmine.Spec.prototype.waits = function(timeout) {
|
||||||
|
@ -2257,5 +2272,5 @@ jasmine.version_= {
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 10,
|
"minor": 10,
|
||||||
"build": 1,
|
"build": 1,
|
||||||
"revision": 1267069453
|
"revision": 1267503060
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue