Permalink
Browse files

make it possible to call assert() standalone and not only inside test()

add new example test
  • Loading branch information...
Andy Wenk
Andy Wenk committed Feb 24, 2013
1 parent a2bef3c commit 32a82fba990ff0f012983d7fc2007efc85df9dd8
Showing with 6 additions and 3 deletions.
  1. +2 −0 javascripts/tests/tests.js
  2. +4 −3 lib/ninjaTest.js
@@ -4,6 +4,8 @@ window.onload = function () {
ninjaTest.createStatusBar();
+ assert(true, "Assertion without a group true");
+
ninjaTest.test("Testset A", function () {
assert(true, "First assertion true");
assert(false, "Second assertion false");
View
@@ -19,8 +19,9 @@ var ninjaTest = (function () {
assert = function (value, description, group) {
var result = createResult(value, description);
+ results = results || byId("results");
append(results, result);
- groupNodeStatus(value, result);
+ groupNodeStatus(value, result, group);
setStatusBarProgress(value, group);
return result;
};
@@ -52,8 +53,8 @@ var ninjaTest = (function () {
return value ? "pass" : "fail";
}
- groupNodeStatus = function (value, result) {
- if(!value) {
+ groupNodeStatus = function (value, result, group) {
+ if(!value && group) {
result.parentNode.parentNode.className = "fail";
}
}

0 comments on commit 32a82fb

Please sign in to comment.