Run spec/same cell tests for manual tests
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Tue, 07 Jun 2011 12:01:33 -0600
changeset 244 c3c95107f265
parent 243 598cb73c6953
child 245 4e7ef1ad32db
Run spec/same cell tests for manual tests
autoimplementation.html
linebreaktest.html
tests.js
--- a/autoimplementation.html	Tue Jun 07 11:54:11 2011 -0600
+++ b/autoimplementation.html	Tue Jun 07 12:01:33 2011 -0600
@@ -16,33 +16,6 @@
 styleWithCSS false and the second is with it true.  (The second table is left
 blank in IE and Opera, which don't support styleWithCSS.)
 
-<div id=toolbar>
-<!-- Note: this is completely not a hack at all. -->
-<style id=alerts>/* body > div > table > tbody > tr:not(.alert):not(:first-child) { display: none } */</style>
-
-<label><input id=alert-checkbox type=checkbox accesskey=a checked onclick='updateAlertRowStyle()'> Display rows without spec <u>a</u>lerts</label>
-
-<label><input id=browser-checkbox type=checkbox accesskey=b checked onclick='localStorage["display-browser-tests"] = event.target.checked'> Run <u>b</u>rowser tests as well as spec tests</label>
-
-<script>
-// Confusingly, we're storing a string here, not a boolean.
-document.querySelector("#alert-checkbox").checked = localStorage["display-alerts"] != "false";
-document.querySelector("#browser-checkbox").checked = localStorage["display-browser-tests"] != "false";
-
-function updateAlertRowStyle() {
-	var checked = document.querySelector("#alert-checkbox").checked;
-	var style = document.querySelector("#alerts");
-	if (checked && !/^\/\*/.test(style.textContent)) {
-		style.textContent = "/* " + style.textContent + " */";
-	} else if (!checked) {
-		style.textContent = style.textContent.replace(/(\/\* | \*\/)/g, "");
-	}
-	localStorage["display-alerts"] = checked;
-}
-updateAlertRowStyle();
-</script>
-</div>
-
 <h1>Table of Contents</h1>
 <ul>
 </ul>
--- a/linebreaktest.html	Tue Jun 07 11:54:11 2011 -0600
+++ b/linebreaktest.html	Tue Jun 07 12:01:33 2011 -0600
@@ -4,10 +4,6 @@
 <title>Line-breaking tests</title>
 <link rel=stylesheet href=tests.css>
 <style>
-body > div > table > tbody > tr > td,
-body > div > table > tbody > tr > th {
-	width: 50% !important;
-}
 #overlay {
 	display: none;
 	position: fixed;
@@ -37,7 +33,7 @@
 
 <div id=tests>
 	<input type=button value="Run tests" onclick="runTests()">
-	<table border=1><tr><th>Input<th>Output</table>
+	<table border=1><tr><th>Input<th>Spec<th>Browser<th>Same</table>
 	<p><label>New test input: <input></label> <input type=button value="Add test" onclick="addTest()">
 </div>
 
@@ -79,14 +75,17 @@
 	var input = document.querySelector("#tests label input");
 	var test = input.value;
 	doInputCell(tr, test);
+	doSpecCell(tr, test, "insertparagraph", false);
 	if (localStorage.getItem("linebreaktest-" + test) !== null) {
 		// Yay, I get to cheat
 		var browserCell = document.createElement("td");
 		tr.appendChild(browserCell);
 		browserCell.innerHTML = localStorage["linebreaktest-" + test];
+		doSameCell(tr);
 		runNextTest(test);
 	} else {
 		doBrowserCell(tr, test, function() {
+			doSameCell(tr);
 			runNextTest(test);
 		});
 	}
--- a/tests.js	Tue Jun 07 11:54:11 2011 -0600
+++ b/tests.js	Tue Jun 07 12:01:33 2011 -0600
@@ -1,3 +1,30 @@
+// Insert the toolbar thingie as soon as the script file is loaded
+var toolbarDiv = document.createElement("div");
+toolbarDiv.id = "toolbar";
+// Note: this is completely not a hack at all.
+toolbarDiv.innerHTML = "<style id=alerts>/* body > div > table > tbody > tr:not(.alert):not(:first-child) { display: none } */</style>"
+	+ "<label><input id=alert-checkbox type=checkbox accesskey=a checked onclick='updateAlertRowStyle()'> Display rows without spec <u>a</u>lerts</label>"
+	+ "<label><input id=browser-checkbox type=checkbox accesskey=b checked onclick='localStorage[\"display-browser-tests\"] = event.target.checked'> Run <u>b</u>rowser tests as well as spec tests</label>";
+
+document.body.appendChild(toolbarDiv);
+
+// Confusingly, we're storing a string here, not a boolean.
+document.querySelector("#alert-checkbox").checked = localStorage["display-alerts"] != "false";
+document.querySelector("#browser-checkbox").checked = localStorage["display-browser-tests"] != "false";
+
+function updateAlertRowStyle() {
+	var checked = document.querySelector("#alert-checkbox").checked;
+	var style = document.querySelector("#alerts");
+	if (checked && !/^\/\*/.test(style.textContent)) {
+		style.textContent = "/* " + style.textContent + " */";
+	} else if (!checked) {
+		style.textContent = style.textContent.replace(/(\/\* | \*\/)/g, "");
+	}
+	localStorage["display-alerts"] = checked;
+}
+updateAlertRowStyle();
+
+// Now for the meat of the file.
 var tests = {
 	backcolor: [
 		'foo[]bar',