jasminewd2
Advanced tools
Comparing version 0.0.8 to 0.0.9
# Changelog for jasminewd2 | ||
# 0.0.9 | ||
- ([790c81e](https://github.com/angular/protractor/commit/790c81eb0aba880fffbdcb4e834eb2161141620c)) | ||
fix(expectations): allow custom matchers to return a promise when actual is not a promise | ||
See angular/protractor#2964 | ||
# 0.0.8 | ||
@@ -4,0 +12,0 @@ |
64
index.js
@@ -156,4 +156,2 @@ /** | ||
var originalWrapCompare = jasmine.Expectation.prototype.wrapCompare; | ||
/** | ||
@@ -173,3 +171,3 @@ * Creates a matcher wrapper that resolves any promises given for actual and | ||
!webdriver.promise.isPromise(expected)) { | ||
originalWrapCompare(name, matcherFactory).apply(this, arguments); | ||
compare(expectation.actual, expected); | ||
} else { | ||
@@ -196,33 +194,39 @@ webdriver.promise.when(expectation.actual).then(function(actual) { | ||
return webdriver.promise.when(result.pass).then(function(pass) { | ||
var message = ''; | ||
if (webdriver.promise.isPromise(result.pass)) { | ||
return webdriver.promise.when(result.pass).then(compareDone); | ||
} else { | ||
return compareDone(result.pass); | ||
} | ||
if (!pass) { | ||
if (!result.message) { | ||
args.unshift(expectation.isNot); | ||
args.unshift(name); | ||
message = expectation.util.buildFailureMessage.apply(null, args); | ||
} else { | ||
if (Object.prototype.toString.apply(result.message) === '[object Function]') { | ||
message = result.message(); | ||
} else { | ||
message = result.message; | ||
} | ||
} | ||
} | ||
function compareDone(pass) { | ||
var message = ''; | ||
if (expected.length == 1) { | ||
expected = expected[0]; | ||
if (!pass) { | ||
if (!result.message) { | ||
args.unshift(expectation.isNot); | ||
args.unshift(name); | ||
message = expectation.util.buildFailureMessage.apply(null, args); | ||
} else { | ||
if (Object.prototype.toString.apply(result.message) === '[object Function]') { | ||
message = result.message(); | ||
} else { | ||
message = result.message; | ||
} | ||
} | ||
var res = { | ||
matcherName: name, | ||
passed: pass, | ||
message: message, | ||
actual: actual, | ||
expected: expected, | ||
error: matchError | ||
}; | ||
expectation.addExpectationResult(pass, res); | ||
}); | ||
} | ||
if (expected.length == 1) { | ||
expected = expected[0]; | ||
} | ||
var res = { | ||
matcherName: name, | ||
passed: pass, | ||
message: message, | ||
actual: actual, | ||
expected: expected, | ||
error: matchError | ||
}; | ||
expectation.addExpectationResult(pass, res); | ||
} | ||
function defaultNegativeCompare() { | ||
@@ -229,0 +233,0 @@ var result = matcher.compare.apply(null, args); |
@@ -17,3 +17,3 @@ { | ||
"jasmine": "2.4.1", | ||
"selenium-webdriver": "2.48.2" | ||
"selenium-webdriver": "2.52.0" | ||
}, | ||
@@ -30,3 +30,3 @@ "repository": { | ||
"license": "MIT", | ||
"version": "0.0.8" | ||
"version": "0.0.9" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
15856
5
246
0
61