Fix IE10
This commit is contained in:
12
.travis.yml
12
.travis.yml
@@ -18,11 +18,11 @@ matrix:
|
|||||||
- env: JASMINE_BROWSER=phantomjs
|
- env: JASMINE_BROWSER=phantomjs
|
||||||
include:
|
include:
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER=firefox
|
- JASMINE_BROWSER="firefox"
|
||||||
- SAUCE_PLATFORM=Linux
|
- SAUCE_PLATFORM="Linux"
|
||||||
- SAUCE_VERSION=''
|
- SAUCE_VERSION=''
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER=safari
|
- JASMINE_BROWSER="safari"
|
||||||
- SAUCE_PLATFORM="OS X 10.8"
|
- SAUCE_PLATFORM="OS X 10.8"
|
||||||
- SAUCE_VERSION=''
|
- SAUCE_VERSION=''
|
||||||
- env:
|
- env:
|
||||||
@@ -38,9 +38,9 @@ matrix:
|
|||||||
- SAUCE_PLATFORM="Windows 7"
|
- SAUCE_PLATFORM="Windows 7"
|
||||||
- SAUCE_VERSION=8
|
- SAUCE_VERSION=8
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER=chrome
|
- JASMINE_BROWSER="chrome"
|
||||||
- SAUCE_PLATFORM=Linux
|
- SAUCE_PLATFORM="Linux"
|
||||||
- SAUCE_VERSION=''
|
- SAUCE_VERSION=''
|
||||||
- env:
|
- env:
|
||||||
- JASMINE_BROWSER=phantomjs
|
- JASMINE_BROWSER="phantomjs"
|
||||||
- USE_SAUCE=false
|
- USE_SAUCE=false
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ describe("toThrowError", function() {
|
|||||||
result = matcher.compare(fn, CustomError);
|
result = matcher.compare(fn, CustomError);
|
||||||
|
|
||||||
expect(result.pass).toBe(true);
|
expect(result.pass).toBe(true);
|
||||||
|
debugger
|
||||||
expect(result.message).toEqual("Expected function not to throw CustomError.");
|
expect(result.message).toEqual("Expected function not to throw CustomError.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -34,28 +34,38 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errorType && message) {
|
if (errorType && message) {
|
||||||
|
var name = errorType.name || errorType.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
var constructorName = thrown.constructor.name || thrown.constructor.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
|
||||||
if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
|
if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
|
||||||
return pass("Expected function not to throw " + errorType.name + " with message \"" + message + "\".");
|
return pass("Expected function not to throw " + name + " with message \"" + message + "\".");
|
||||||
} else {
|
} else {
|
||||||
return fail("Expected function to throw " + errorType.name + " with message \"" + message +
|
return fail("Expected function to throw " + name + " with message \"" + message +
|
||||||
"\", but it threw " + thrown.constructor.name + " with message \"" + thrown.message + "\".");
|
"\", but it threw " + constructorName + " with message \"" + thrown.message + "\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorType && regexp) {
|
if (errorType && regexp) {
|
||||||
|
var name = errorType.name || errorType.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
var constructorName = thrown.constructor.name || thrown.constructor.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
|
||||||
if (thrown.constructor == errorType && regexp.test(thrown.message)) {
|
if (thrown.constructor == errorType && regexp.test(thrown.message)) {
|
||||||
return pass("Expected function not to throw " + errorType.name + " with message matching " + regexp + ".");
|
return pass("Expected function not to throw " + name + " with message matching " + regexp + ".");
|
||||||
} else {
|
} else {
|
||||||
return fail("Expected function to throw " + errorType.name + " with message matching " + regexp +
|
return fail("Expected function to throw " + name + " with message matching " + regexp +
|
||||||
", but it threw " + thrown.constructor.name + " with message \"" + thrown.message + "\".");
|
", but it threw " + constructorName + " with message \"" + thrown.message + "\".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorType) {
|
if (errorType) {
|
||||||
|
var name = errorType.name || errorType.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
var constructorName = thrown.constructor.name || thrown.constructor.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
||||||
|
|
||||||
|
|
||||||
if (thrown.constructor == errorType) {
|
if (thrown.constructor == errorType) {
|
||||||
return pass("Expected function not to throw " + errorType.name + ".");
|
return pass("Expected function not to throw " + name + ".");
|
||||||
} else {
|
} else {
|
||||||
return fail("Expected function to throw " + errorType.name + ", but it threw " + thrown.constructor.name + ".");
|
return fail("Expected function to throw " + name + ", but it threw " + constructorName + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user