Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show fancy error display

  • Loading branch information...
commit 738e380b6908d0b73eccf903b76df58a09a473cb 1 parent fd3a374
@elcuervo authored
Showing with 55 additions and 1 deletion.
  1. +55 −1 test/gerbil.html
View
56 test/gerbil.html
@@ -2,7 +2,61 @@
<head>
<script type="text/javascript" src="../lib/gerbil.js"></script>
<script type="text/javascript" src="gerbil.js"></script>
+ <script type="text/javascript" src="test.js"></script>
+ <script type="text/javascript">
+ var runTests = function() {
+ var results = document.querySelector("#results");
+ var ul = false;
+ var pretty_print = {
+ log: function(msg) {
+ var li = document.createElement("li");
+ li.className = "ok"
+
+ li.textContent = msg;
+ ul.appendChild(li);
+ },
+ info: function(msg) {
+ var h1 = document.createElement("h1");
+ ul = document.createElement("ul");
+
+ h1.textContent = msg;
+ results.appendChild(h1);
+ results.appendChild(ul);
+ },
+ warn: function(msg) {
+ var h2 = document.createElement("h2");
+ h2.textContent = msg;
+ results.appendChild(h2);
+ },
+ error: function(msg) {
+ var li = document.createElement("li");
+
+ li.className = "error"
+ li.textContent = msg;
+ ul.appendChild(li);
+ },
+ };
+
+ scenario("Showing a pretty print for the tests", {
+ "setup": function() {
+ },
+ "it should show a success message": function(g) {
+ g.assert(true);
+ },
+ "it should show an error message": function(g) {
+ g.assert(false);
+ }
+ }, pretty_print);
+ }
+ </script>
+ <style type="text/css">
+ li { list-style-type: none }
+ .error { color: red; }
+ .ok { color: green; }
+ </style>
</head>
- <body>
+ <body onload="runTests()">
+ <div id="results">
+ </div>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.