2009-08-10 23:00:42 +00:00
|
|
|
describe("TrivialReporter", function() {
|
2009-08-11 00:50:03 +00:00
|
|
|
var trivialReporter;
|
|
|
|
var body;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
body = document.createElement("body");
|
|
|
|
});
|
|
|
|
|
2009-08-10 23:00:42 +00:00
|
|
|
function fakeSpec(name) {
|
|
|
|
return {
|
|
|
|
getFullName: function() { return name; }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-08-11 00:50:03 +00:00
|
|
|
it("should run only specs beginning with spec parameter", function() {
|
|
|
|
trivialReporter = new jasmine.TrivialReporter({ location: {search: "?spec=run%20this"} });
|
2009-08-10 23:00:42 +00:00
|
|
|
expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
|
2009-08-11 00:50:03 +00:00
|
|
|
expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
|
|
|
|
expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
|
2009-08-10 23:00:42 +00:00
|
|
|
});
|
|
|
|
|
2009-08-11 00:50:03 +00:00
|
|
|
it("should display empty divs for every suite when the runner is starting", function() {
|
|
|
|
trivialReporter = new jasmine.TrivialReporter({ body: body });
|
|
|
|
trivialReporter.reportRunnerStarting({
|
|
|
|
getAllSuites: function() {
|
|
|
|
return [ new jasmine.Suite(null, "suite 1", null, null) ];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var divs = body.getElementsByTagName("div");
|
|
|
|
expect(divs.length).toEqual(1);
|
|
|
|
expect(divs[0].innerHTML).toContain("suite 1");
|
2009-08-10 23:00:42 +00:00
|
|
|
});
|
|
|
|
});
|