Added the ability to turn the results on and off
authorPhilippe Le Hégaret <plh@w3.org>
Fri, 05 Dec 2008 21:23:41 +0000
changeset 35 82e8158c58a5
parent 34 a71848929172
child 36 4f68b4a79d9a
Added the ability to turn the results on and off
testsuite/web-framework/functions.js
--- a/testsuite/web-framework/functions.js	Fri Dec 05 14:41:16 2008 +0000
+++ b/testsuite/web-framework/functions.js	Fri Dec 05 21:23:41 2008 +0000
@@ -99,11 +99,12 @@
     clearTestArea();
 
     // reset the table of pass/fail
-    resetAll();
-
-    // reset the report
-    var report_content = document.getElementById("report_content");
-    report_content.innerHTML = '';
+    if (displayResult) {
+	resetAll();
+	// reset the report
+	var report_content = document.getElementById("report_content");
+	report_content.innerHTML = '';
+    }
 
     if (player != null) {
 	player.stopPlayer();
@@ -177,8 +178,9 @@
 	    var div = document.getElementById('testobject');
 	    div.innerHTML = '<p><b>Choose a player...</b></p>';	    
 	} else {
-	    addResultButtons(test_number);
-	    
+	    if (displayTest) {
+		addResultButtons(test_number);
+	    }
 	    player.startTest(test_number,
 			     tests[test_number].filename,
 			     autostart,
@@ -239,8 +241,10 @@
     title.innerHTML = "";
     var descr = document.getElementById("description");
     descr.innerHTML = "";
-    var p = document.getElementById("result");
-    p.innerHTML = "";
+    if (displayTest) {
+	var p = document.getElementById("result");
+	p.innerHTML = "";
+    }
 
 }
 
@@ -248,6 +252,8 @@
 // Handle the fail/pass/unknown status
 //************************************
 
+var displayResult = true;
+
 var results = new Array();
 
 var skipOnResult = false;
@@ -553,7 +559,7 @@
 	return;
     }
 
-    initResults();
+    if (displayResult) initResults();
 
     // populate the player list
     var select = document.getElementById("players");
@@ -575,9 +581,11 @@
 	opt.innerHTML = categories[i];
 	select.appendChild(opt);
     }
-    opt = document.createElement("option");
-    opt.innerHTML = "See the report";
-    select.appendChild(opt);
+    if (displayResult) {
+	opt = document.createElement("option");
+	opt.innerHTML = "See the report";
+	select.appendChild(opt);
+    }
 
     var tables = document.getElementById("tables");
     var isRemote = false;
@@ -625,9 +633,11 @@
 		    td.appendChild(span);		    
 		}
 		tr.appendChild(td);
-		td = document.createElement("td"); // for the result
-		td.setAttribute("id", "r" + i);
-		tr.appendChild(td);
+		if (displayResult) {
+		    td = document.createElement("td"); // for the result
+		    td.setAttribute("id", "r" + i);
+		    tr.appendChild(td);
+		}
 		tbody.appendChild(tr);
 		table.appendChild(tbody);
 	    }