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({
|
2009-09-02 14:52:11 +00:00
|
|
|
suites: function() {
|
2009-08-15 01:04:52 +00:00
|
|
|
return [ new jasmine.Suite({}, "suite 1", null, null) ];
|
2009-08-11 00:50:03 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var divs = body.getElementsByTagName("div");
|
2009-08-12 17:15:15 +00:00
|
|
|
expect(divs.length).toEqual(2);
|
|
|
|
expect(divs[1].innerHTML).toContain("suite 1");
|
2009-08-10 23:00:42 +00:00
|
|
|
});
|
|
|
|
});
|