Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1016 bytes
|
Line | |
---|
1 | /* global MyCustomLogger, log */
|
---|
2 | "use strict";
|
---|
3 |
|
---|
4 | describe("loglevel from a global <script> tag with a custom context", function () {
|
---|
5 | it("is available globally", function () {
|
---|
6 | expect(MyCustomLogger).not.toBeUndefined();
|
---|
7 | });
|
---|
8 |
|
---|
9 | it("doesn't have log defined globally", function () {
|
---|
10 | expect(window.log).not.toBeDefined();
|
---|
11 | });
|
---|
12 |
|
---|
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);
|
---|
19 | });
|
---|
20 |
|
---|
21 | it("successfully logs", function () {
|
---|
22 | window.console = { "log": jasmine.createSpy("log") };
|
---|
23 |
|
---|
24 | MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
|
---|
25 | MyCustomLogger.info("test message");
|
---|
26 |
|
---|
27 | expect(console.log).toHaveBeenCalledWith("test message");
|
---|
28 | });
|
---|
29 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.