Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fixes error when clicking pending test in html report

Casey Foster236cea1e5f7f
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index 9f799da0..da44579d 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -134,17 +134,16 @@ function HTML(runner) {
}
// toggle code
- var h2 = el.getElementsByTagName('h2')[0];
-
- on(h2, 'click', function(){
- pre.style.display = 'none' == pre.style.display
- ? 'inline-block'
- : 'none';
- });
-
- // code
// TODO: defer
if (!test.pending) {
+ var h2 = el.getElementsByTagName('h2')[0];
+
+ on(h2, 'click', function(){
+ pre.style.display = 'none' == pre.style.display
+ ? 'inline-block'
+ : 'none';
+ });
+
var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
el.appendChild(pre);
pre.style.display = 'none';