jasmine/spec/suites/TrivialReporterTest.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

describe("TrivialReporter", function() {
2009-08-11 00:50:03 +00:00
var trivialReporter;
var body;
beforeEach(function() {
body = document.createElement("body");
});
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"} });
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-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");
});
});