1 /* global MyCustomLogger, log */
4 describe("loglevel from a global <script> tag with a custom context", function () {
5 it("is available globally", function () {
6 expect(MyCustomLogger).not.toBeUndefined();
9 it("doesn't have log defined globally", function () {
10 expect(window.log).not.toBeDefined();
13 it("allows setting the logging level", function () {
14 MyCustomLogger.setLevel(MyCustomLogger.levels.TRACE);
15 MyCustomLogger.setLevel(MyCustomLogger.levels.DEBUG);
16 MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
17 MyCustomLogger.setLevel(MyCustomLogger.levels.WARN);
18 MyCustomLogger.setLevel(MyCustomLogger.levels.ERROR);
21 it("successfully logs", function () {
22 window.console = { "log": jasmine.createSpy("log") };
24 MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
25 MyCustomLogger.info("test message");
27 expect(console.log).toHaveBeenCalledWith("test message");