From 0557fc93dd6e617d4f7cb53ec1003be288a91227 Mon Sep 17 00:00:00 2001 From: tmont Date: Wed, 1 Jul 2009 05:48:53 +0000 Subject: [PATCH] added rest of the graphs, and fixed event bubbling issues --- .../framework/reporting/CoverageReporter.php | 2 + .../reporting/template/directory.html | 2 +- .../framework/reporting/template/tunit.js | 43 +++++++++++++------ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/TUnit/framework/reporting/CoverageReporter.php b/src/TUnit/framework/reporting/CoverageReporter.php index 3a2fe3b..28c72a2 100644 --- a/src/TUnit/framework/reporting/CoverageReporter.php +++ b/src/TUnit/framework/reporting/CoverageReporter.php @@ -345,6 +345,7 @@ $info .= '' . $subdata['cloc'] . ' / ' . ($subdata['loc'] - $subdata['dloc']) . ''; $info .= "$percentageData[0]%"; $info .= "\n"; + $info .= 'Code Coverage results'; } //regular files in current directory @@ -354,6 +355,7 @@ $info .= '' . $fileData['cloc'] . ' / ' . ($fileData['loc'] - $fileData['dloc']) . ''; $info .= "$percentageData[0]%"; $info .= "\n"; + $info .= 'Code Coverage results'; } $temp = str_replace( diff --git a/src/TUnit/framework/reporting/template/directory.html b/src/TUnit/framework/reporting/template/directory.html index 980784c..5ca356c 100644 --- a/src/TUnit/framework/reporting/template/directory.html +++ b/src/TUnit/framework/reporting/template/directory.html @@ -21,7 +21,7 @@

${file.link}

-
+
diff --git a/src/TUnit/framework/reporting/template/tunit.js b/src/TUnit/framework/reporting/template/tunit.js index 17a646b..fda7c4a 100644 --- a/src/TUnit/framework/reporting/template/tunit.js +++ b/src/TUnit/framework/reporting/template/tunit.js @@ -30,23 +30,25 @@ toggler.style.cursor = "pointer"; toggler.onmouseover = function() { - var child = this.firstChild; - do { - if (child.nodeName === "TD" || child.nodeName === "TH") { - child.style.backgroundColor = "#990099"; - child.style.color = "#FFFFFF"; - } - } while (child = child.nextSibling); + var th = this.getElementsByTagName("th")[0]; + th.style.backgroundColor = "#990099"; + th.style.color = "#FFFFFF"; + var a = th.getElementsByTagName("a"); + if (a.length > 0) { + a[0].style.backgroundColor = "#990099"; + a[0].style.color = "#FFFFFF"; + } } toggler.onmouseout = function() { - var child = this.firstChild; - do { - if (child.nodeName === "TD" || child.nodeName === "TH") { - child.style.backgroundColor = ""; - child.style.color = ""; - } - } while (child = child.nextSibling); + var th = this.getElementsByTagName("th")[0]; + th.style.backgroundColor = ""; + th.style.color = ""; + var a = th.getElementsByTagName("a"); + if (a.length > 0) { + a[0].style.backgroundColor = ""; + a[0].style.color = ""; + } } toggler.onclick = function() { @@ -54,6 +56,19 @@ this.nextSibling.nextSibling.style.display = (display === "none") ? "table-row" : "none"; } + //cancel event bubbling on the anchors + var a = toggler.getElementsByTagName("a"); + for (var j = 0, jlen = a.length; j < jlen; j++) { + a[j].onclick = function(e) { + e = e || window.event; + if (e.stopPropagation) { + e.stopPropagation(); + } else { + e.cancelBubble = true; + } + } + } + graphs[i].style.display = "none"; } }