-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CactusReport and tests. Refactoring of prints.
- Loading branch information
Winston Teo
committed
Mar 19, 2012
1 parent
226351b
commit db480b6
Showing
3 changed files
with
195 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
describe("CactusReport", function() { | ||
|
||
describe("displays Cactus feedback in div#cactus", function() { | ||
beforeEach(function() { | ||
$("#cactus").remove(); | ||
}); | ||
afterEach(function() { | ||
$("#cactus").remove(); | ||
}); | ||
|
||
describe("all tests passed", function() { | ||
beforeEach(function() { | ||
CactusReport.render(true, "test 1 passed"); | ||
}); | ||
|
||
it("hides toggle for failures", function() { | ||
expect($(".cactus_toggle_pass").is(":visible")).toBeTruthy(); | ||
expect($(".cactus_toggle_fail").is(":visible")).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
describe("all tests failed", function() { | ||
beforeEach(function() { | ||
CactusReport.render(false, "test 1 failed"); | ||
}); | ||
|
||
it("hides toggle for passes", function() { | ||
expect($(".cactus_toggle_pass").is(":visible")).toBeFalsy(); | ||
expect($(".cactus_toggle_fail").is(":visible")).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe("some tests passed, some tests failed", function() { | ||
beforeEach(function() { | ||
CactusReport.render(true , "test 1 passed"); | ||
CactusReport.render(false, "test 2 failed"); | ||
}); | ||
|
||
it("displays div#cactus", function() { | ||
expect($("#cactus").is(":visible")).toBeTruthy(); | ||
}); | ||
|
||
it("contains 1 pass and 1 failure", function() { | ||
expect($("#cactus .cactus_pass").length).toEqual(1); | ||
expect($("#cactus .cactus_fail").length).toEqual(1); | ||
}); | ||
|
||
it("shows toggles for passes and failures", function() { | ||
expect($(".cactus_toggle_pass").is(":visible")).toBeTruthy(); | ||
expect($(".cactus_toggle_fail").is(":visible")).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe("passes are hidden by default", function() { | ||
beforeEach(function() { | ||
CactusReport.render(true , "test 1 passed"); | ||
}); | ||
|
||
it("is hidden", function() { | ||
expect($("#cactus .cactus_pass").is(":visible")).toBeFalsy(); | ||
}); | ||
|
||
it("is shown when clicked on 'Show Passes'", function() { | ||
$(".cactus_toggle_pass").click(); | ||
expect($("#cactus .cactus_pass").is(":visible")).toBeTruthy(); | ||
}) | ||
}); | ||
|
||
describe("failures are shown by default", function() { | ||
beforeEach(function() { | ||
CactusReport.render(false, "test 1 failed"); | ||
}); | ||
|
||
it("is shown", function() { | ||
expect($("#cactus .cactus_fail").is(":visible")).toBeTruthy(); | ||
}); | ||
|
||
it("is shown when clicked on 'Show Passes'", function() { | ||
$(".cactus_toggle_fail").click(); | ||
expect($("#cactus .cactus_fail").is(":visible")).toBeFalsy(); | ||
}) | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters