Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

error name title in spec.html is now set to the expected error type r…

…ather than the real one.
  • Loading branch information...
commit 60db7fba25d763a4614e752d2e708cb7674e564c 1 parent ae0a243
@toolness toolness authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 demo/spec.js
View
13 demo/spec.js
@@ -61,8 +61,14 @@ $(window).ready(function() {
var badHtml = badHtmlElement.text().trim();
var t = $("#templates .report").clone();
var js = $('div.js', this).text().trim();
- var error;
+ var expect = $('script[type="application/json"]', this).text();
+ var error, expectedError, expectedErrorType;
+ if (expect) {
+ expectedError = JSON.parse(expect);
+ expectedErrorType = expectedError.type;
+ }
+
if (!js)
js = $(".js > div:first-child", t).text();
js = js.replace("{{HTML}}", JSON.stringify(badHtml));
@@ -72,13 +78,14 @@ $(window).ready(function() {
error = eval(js);
} catch (e) {
$(this).addClass("failed");
- $("h2", t).text("");
+ $("h2", t).text(expectedErrorType || "UNKNOWN");
$(".result", t).text(e.toString());
badHtmlElement.replaceWith(t);
return;
}
- $("h2", t).text(error.type).attr("id", error.type);
+ expectedErrorType = expectedErrorType || error.type;
+ $("h2", t).text(expectedErrorType).attr("id", expectedErrorType);
$(".result", t).text(JSON.stringify(error, null, " "));
var errMsg = $(".error", t);
Please sign in to comment.
Something went wrong with that request. Please try again.