jasmine-core 1.3.1 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/lib/jasmine-core.rb +14 -1
  2. data/lib/jasmine-core/boot.js +131 -0
  3. data/lib/jasmine-core/boot/boot.js +109 -0
  4. data/lib/jasmine-core/example/spec/PlayerSpec.js +2 -2
  5. data/lib/jasmine-core/example/spec/SpecHelper.js +14 -8
  6. data/lib/jasmine-core/jasmine-html.js +289 -616
  7. data/lib/jasmine-core/jasmine.css +52 -80
  8. data/lib/jasmine-core/jasmine.js +1972 -2211
  9. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +161 -386
  10. data/lib/jasmine-core/spec/core/AnySpec.js +45 -0
  11. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +105 -0
  12. data/lib/jasmine-core/spec/core/ClockSpec.js +314 -0
  13. data/lib/jasmine-core/spec/core/CustomMatchersSpec.js +96 -97
  14. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +179 -0
  15. data/lib/jasmine-core/spec/core/EnvSpec.js +454 -102
  16. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +56 -0
  17. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +15 -126
  18. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
  19. data/lib/jasmine-core/spec/core/ExpectationSpec.js +320 -0
  20. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +150 -38
  21. data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +64 -0
  22. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +43 -42
  23. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +147 -0
  24. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +40 -0
  25. data/lib/jasmine-core/spec/core/SpecRunningSpec.js +92 -1075
  26. data/lib/jasmine-core/spec/core/SpecSpec.js +215 -95
  27. data/lib/jasmine-core/spec/core/SpySpec.js +28 -196
  28. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +101 -0
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +216 -106
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +13 -0
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +19 -30
  32. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +219 -0
  33. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +51 -0
  34. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
  35. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
  36. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +19 -0
  37. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
  38. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +36 -0
  39. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
  40. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
  41. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
  42. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +17 -0
  43. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +24 -0
  44. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +28 -0
  45. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +46 -0
  46. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +57 -0
  47. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +34 -0
  48. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +280 -0
  49. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +98 -0
  50. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +19 -0
  51. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +494 -0
  52. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
  53. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +8 -8
  54. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +3 -3
  55. data/lib/jasmine-core/spec/html/QueryStringSpec.js +43 -0
  56. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
  57. data/lib/jasmine-core/spec/node_suite.js +137 -79
  58. data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
  59. data/lib/jasmine-core/spec/support/dev_boot.js +118 -0
  60. data/lib/jasmine-core/version.rb +5 -2
  61. metadata +47 -103
  62. data/lib/jasmine-core/example/SpecRunner.html +0 -54
  63. data/lib/jasmine-core/spec/core/BaseSpec.js +0 -27
  64. data/lib/jasmine-core/spec/core/MatchersSpec.js +0 -1157
  65. data/lib/jasmine-core/spec/core/MockClockSpec.js +0 -38
  66. data/lib/jasmine-core/spec/core/MultiReporterSpec.js +0 -45
  67. data/lib/jasmine-core/spec/core/NestedResultsSpec.js +0 -54
  68. data/lib/jasmine-core/spec/core/QueueSpec.js +0 -23
  69. data/lib/jasmine-core/spec/core/ReporterSpec.js +0 -56
  70. data/lib/jasmine-core/spec/core/RunnerSpec.js +0 -280
  71. data/lib/jasmine-core/spec/core/WaitsForBlockSpec.js +0 -118
  72. data/lib/jasmine-core/spec/html/HTMLReporterSpec.js +0 -209
  73. data/lib/jasmine-core/spec/html/TrivialReporterSpec.js +0 -239
@@ -1,118 +0,0 @@
1
- describe('WaitsForBlock', function () {
2
- var env, suite, timeout, spec, message, onComplete, fakeTimer;
3
- beforeEach(function() {
4
- env = new jasmine.Env();
5
- env.updateInterval = 0;
6
- suite = new jasmine.Suite(env, 'suite 1');
7
- timeout = 1000;
8
- spec = new jasmine.Spec(env, suite);
9
- message = "some error message";
10
- onComplete = jasmine.createSpy("onComplete");
11
- });
12
-
13
- describe("jasmine.VERBOSE", function() {
14
- var jasmineVerboseOriginal;
15
- beforeEach(function() {
16
- jasmineVerboseOriginal = jasmine.VERBOSE;
17
- spyOn(env.reporter, 'log');
18
-
19
- });
20
- it('do not show information if jasmine.VERBOSE is set to false', function () {
21
- jasmine.VERBOSE = false;
22
- var latchFunction = function() {
23
- return true;
24
- };
25
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
26
- expect(env.reporter.log).not.toHaveBeenCalled();
27
- block.execute(onComplete);
28
- expect(env.reporter.log).not.toHaveBeenCalled();
29
- jasmine.VERBOSE = jasmineVerboseOriginal;
30
- });
31
- it('show information if jasmine.VERBOSE is set to true', function () {
32
- jasmine.VERBOSE = true;
33
- var latchFunction = function() {
34
- return true;
35
- };
36
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
37
- expect(env.reporter.log).not.toHaveBeenCalled();
38
- block.execute(onComplete);
39
- expect(env.reporter.log).toHaveBeenCalled();
40
- jasmine.VERBOSE = jasmineVerboseOriginal;
41
- });
42
- });
43
-
44
- it('onComplete should be called if the latchFunction returns true', function () {
45
- var latchFunction = function() {
46
- return true;
47
- };
48
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
49
- expect(onComplete).not.toHaveBeenCalled();
50
- block.execute(onComplete);
51
- expect(onComplete).toHaveBeenCalled();
52
- });
53
-
54
- it('latchFunction should run in same scope as spec', function () {
55
- var result;
56
- var latchFunction = function() {
57
- result = this.scopedValue;
58
- };
59
- spec.scopedValue = 'foo';
60
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
61
- block.execute(onComplete);
62
- expect(result).toEqual('foo');
63
- });
64
-
65
- it('should fail spec and call onComplete if there is an error in the latchFunction', function() {
66
- var latchFunction = jasmine.createSpy('latchFunction').andThrow('some error');
67
- spyOn(spec, 'fail');
68
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
69
- block.execute(onComplete);
70
- expect(spec.fail).toHaveBeenCalledWith('some error');
71
- expect(onComplete).toHaveBeenCalled();
72
- });
73
-
74
- describe("if latchFunction returns false", function() {
75
- var latchFunction, fakeTimer;
76
- beforeEach(function() {
77
- latchFunction = jasmine.createSpy('latchFunction').andReturn(false);
78
- fakeTimer = new jasmine.FakeTimer();
79
- env.setTimeout = fakeTimer.setTimeout;
80
- env.clearTimeout = fakeTimer.clearTimeout;
81
- env.setInterval = fakeTimer.setInterval;
82
- env.clearInterval = fakeTimer.clearInterval;
83
- });
84
-
85
- it('latchFunction should be retried after 10 ms', function () {
86
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
87
- expect(latchFunction).not.toHaveBeenCalled();
88
- block.execute(onComplete);
89
- expect(latchFunction.callCount).toEqual(1);
90
- fakeTimer.tick(5);
91
- expect(latchFunction.callCount).toEqual(1);
92
- fakeTimer.tick(5);
93
- expect(latchFunction.callCount).toEqual(2);
94
- });
95
-
96
- it('onComplete should be called if latchFunction returns true before timeout', function () {
97
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
98
- expect(onComplete).not.toHaveBeenCalled();
99
- block.execute(onComplete);
100
- expect(onComplete).not.toHaveBeenCalled();
101
- latchFunction.andReturn(true);
102
- fakeTimer.tick(100);
103
- expect(onComplete).toHaveBeenCalled();
104
- });
105
-
106
- it('spec should fail with the passed message if the timeout is reached (and not call onComplete)', function () {
107
- spyOn(spec, 'fail');
108
- var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
109
- block.execute(onComplete);
110
- expect(spec.fail).not.toHaveBeenCalled();
111
- fakeTimer.tick(timeout);
112
- expect(spec.fail).toHaveBeenCalled();
113
- var failMessage = spec.fail.mostRecentCall.args[0].message;
114
- expect(failMessage).toMatch(message);
115
- expect(onComplete).toHaveBeenCalled();
116
- });
117
- });
118
- });
@@ -1,209 +0,0 @@
1
- describe("HtmlReporter", function() {
2
- var env;
3
- var htmlReporter;
4
- var body;
5
- var fakeDocument;
6
-
7
- beforeEach(function() {
8
- env = new jasmine.Env();
9
- env.updateInterval = 0;
10
-
11
- body = document.createElement("body");
12
- fakeDocument = { body: body, location: { search: "" } };
13
- htmlReporter = new jasmine.HtmlReporter(fakeDocument);
14
- });
15
-
16
- function fakeSpec(name) {
17
- return {
18
- getFullName: function() {
19
- return name;
20
- }
21
- };
22
- }
23
-
24
- function findElements(divs, withClass) {
25
- var els = [];
26
- for (var i = 0; i < divs.length; i++) {
27
- if (divs[i].className == withClass) els.push(divs[i]);
28
- }
29
- return els;
30
- }
31
-
32
- function findElement(divs, withClass) {
33
- var els = findElements(divs, withClass);
34
- if (els.length > 0) {
35
- return els[0];
36
- }
37
- throw new Error("couldn't find div with class " + withClass);
38
- }
39
-
40
- it("should run only specs beginning with spec parameter", function() {
41
- fakeDocument.location.search = "?spec=run%20this";
42
- expect(htmlReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
43
- expect(htmlReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
44
- expect(htmlReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
45
- });
46
-
47
- describe("running without any specs", function() {
48
- var runner;
49
- beforeEach(function() {
50
- runner = env.currentRunner();
51
- env.addReporter(htmlReporter);
52
- });
53
-
54
- it("should not error", function() {
55
- var exec = function() {
56
- runner.execute();
57
- };
58
- expect(exec).not.toThrow();
59
- });
60
- });
61
-
62
- describe('Matcher reporting', function() {
63
- var getResultMessageDiv = function(body) {
64
- var divs = body.getElementsByTagName("div");
65
- for (var i = 0; i < divs.length; i++) {
66
- if (divs[i].className.match(/resultMessage/)) {
67
- return divs[i];
68
- }
69
- }
70
- };
71
-
72
- var runner, spec, fakeTimer;
73
- beforeEach(function() {
74
- fakeTimer = new jasmine.FakeTimer();
75
- env.setTimeout = fakeTimer.setTimeout;
76
- env.clearTimeout = fakeTimer.clearTimeout;
77
- env.setInterval = fakeTimer.setInterval;
78
- env.clearInterval = fakeTimer.clearInterval;
79
- runner = env.currentRunner();
80
- var suite = new jasmine.Suite(env, 'some suite');
81
- runner.add(suite);
82
- spec = new jasmine.Spec(env, suite, 'some spec');
83
- suite.add(spec);
84
- fakeDocument.location.search = "?";
85
- env.addReporter(htmlReporter);
86
- });
87
-
88
- describe('toContain', function() {
89
- it('should show actual and expected', function() {
90
- spec.runs(function() {
91
- this.expect('foo').toContain('bar');
92
- });
93
- runner.execute();
94
- fakeTimer.tick(0);
95
-
96
- var resultEl = getResultMessageDiv(body);
97
- expect(resultEl.innerHTML).toMatch(/foo/);
98
- expect(resultEl.innerHTML).toMatch(/bar/);
99
- });
100
- });
101
- });
102
-
103
- describe("failure messages (integration)", function() {
104
- var spec, results, expectationResult;
105
-
106
- it("should add the failure message to the DOM (non-toEquals matchers)", function() {
107
- env.describe("suite", function() {
108
- env.it("will have log messages", function() {
109
- this.expect('a').toBeNull();
110
- });
111
- });
112
-
113
- env.addReporter(htmlReporter);
114
- env.execute();
115
-
116
- var divs = body.getElementsByTagName("div");
117
- var errorDiv = findElement(divs, 'resultMessage fail');
118
- expect(errorDiv.innerHTML).toMatch(/Expected 'a' to be null/);
119
- });
120
-
121
- it("should add the failure message to the DOM (non-toEquals matchers) html escaping", function() {
122
- env.describe("suite", function() {
123
- env.it("will have log messages", function() {
124
- this.expect('1 < 2').toBeNull();
125
- });
126
- });
127
-
128
- env.addReporter(htmlReporter);
129
- env.execute();
130
-
131
- var divs = body.getElementsByTagName("div");
132
- var errorDiv = findElement(divs, 'resultMessage fail');
133
- expect(errorDiv.innerHTML).toMatch(/Expected '1 &lt; 2' to be null/);
134
- });
135
- });
136
-
137
- describe("log messages", function() {
138
- it("should appear in the report of a failed spec", function() {
139
- env.describe("suite", function() {
140
- env.it("will have log messages", function() {
141
- this.log("this is a", "multipart log message");
142
- this.expect(true).toBeFalsy();
143
- });
144
- });
145
-
146
- env.addReporter(htmlReporter);
147
- env.execute();
148
-
149
- var divs = body.getElementsByTagName("div");
150
- var errorDiv = findElement(divs, 'specDetail failed');
151
- expect(errorDiv.innerHTML).toMatch("this is a multipart log message");
152
- });
153
-
154
- xit("should work on IE without console.log.apply", function() {
155
- });
156
- });
157
-
158
- describe("duplicate example names", function() {
159
- it("should report failures correctly", function() {
160
- var suite1 = env.describe("suite", function() {
161
- env.it("will have log messages", function() {
162
- this.log("this one fails!");
163
- this.expect(true).toBeFalsy();
164
- });
165
- });
166
-
167
- var suite2 = env.describe("suite", function() {
168
- env.it("will have log messages", function() {
169
- this.log("this one passes!");
170
- this.expect(true).toBeTruthy();
171
- });
172
- });
173
-
174
- env.addReporter(htmlReporter);
175
- env.execute();
176
-
177
- var divs = body.getElementsByTagName("div");
178
- var failedSpecDiv = findElement(divs, 'specDetail failed');
179
- expect(failedSpecDiv.className).toEqual('specDetail failed');
180
- expect(failedSpecDiv.innerHTML).toContain("this one fails!");
181
- expect(failedSpecDiv.innerHTML).not.toContain("this one passes!");
182
- });
183
- });
184
-
185
- describe('#reportSpecStarting', function() {
186
- beforeEach(function() {
187
- env.describe("suite 1", function() {
188
- env.it("spec 1", function() {
189
- });
190
- });
191
- spyOn(htmlReporter, 'log').andCallThrough();
192
- });
193
-
194
- it('DOES NOT log running specs by default', function() {
195
- env.addReporter(htmlReporter);
196
- env.execute();
197
-
198
- expect(htmlReporter.log).not.toHaveBeenCalled();
199
- });
200
-
201
- it('logs running specs when log_running_specs is true', function() {
202
- htmlReporter.logRunningSpecs = true;
203
- env.addReporter(htmlReporter);
204
- env.execute();
205
-
206
- expect(htmlReporter.log).toHaveBeenCalledWith('>> Jasmine Running suite 1 spec 1...');
207
- });
208
- });
209
- });
@@ -1,239 +0,0 @@
1
- describe("TrivialReporter", function() {
2
- var env;
3
- var trivialReporter;
4
- var body;
5
- var fakeDocument;
6
-
7
- beforeEach(function() {
8
- env = new jasmine.Env();
9
- env.updateInterval = 0;
10
-
11
- body = document.createElement("body");
12
- fakeDocument = { body: body, location: { search: "" } };
13
- trivialReporter = new jasmine.TrivialReporter(fakeDocument);
14
- });
15
-
16
- function fakeSpec(name) {
17
- return {
18
- getFullName: function() {
19
- return name;
20
- }
21
- };
22
- }
23
-
24
- function findElements(divs, withClass) {
25
- var els = [];
26
- for (var i = 0; i < divs.length; i++) {
27
- if (divs[i].className == withClass) els.push(divs[i]);
28
- }
29
- return els;
30
- }
31
-
32
- function findElement(divs, withClass) {
33
- var els = findElements(divs, withClass);
34
- if (els.length > 0) {
35
- return els[0];
36
- }
37
- throw new Error("couldn't find div with class " + withClass);
38
- }
39
-
40
- it("should run only specs beginning with spec parameter", function() {
41
- fakeDocument.location.search = "?spec=run%20this";
42
- expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
43
- expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
44
- expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
45
- });
46
-
47
- it("should display empty divs for every suite when the runner is starting", function() {
48
- trivialReporter.reportRunnerStarting({
49
- env: env,
50
- suites: function() {
51
- return [ new jasmine.Suite({}, "suite 1", null, null) ];
52
- }
53
- });
54
-
55
- var divs = findElements(body.getElementsByTagName("div"), "suite");
56
- expect(divs.length).toEqual(1);
57
- expect(divs[0].innerHTML).toContain("suite 1");
58
- });
59
-
60
- describe('Matcher reporting', function () {
61
- var getResultMessageDiv = function (body) {
62
- var divs = body.getElementsByTagName("div");
63
- for (var i = 0; i < divs.length; i++) {
64
- if (divs[i].className.match(/resultMessage/)) {
65
- return divs[i];
66
- }
67
- }
68
- };
69
-
70
- var runner, spec, fakeTimer;
71
- beforeEach(function () {
72
- fakeTimer = new jasmine.FakeTimer();
73
- env.setTimeout = fakeTimer.setTimeout;
74
- env.clearTimeout = fakeTimer.clearTimeout;
75
- env.setInterval = fakeTimer.setInterval;
76
- env.clearInterval = fakeTimer.clearInterval;
77
- runner = env.currentRunner();
78
- var suite = new jasmine.Suite(env, 'some suite');
79
- runner.add(suite);
80
- spec = new jasmine.Spec(env, suite, 'some spec');
81
- suite.add(spec);
82
- fakeDocument.location.search = "?";
83
- env.addReporter(trivialReporter);
84
- });
85
-
86
- describe('toContain', function () {
87
- it('should show actual and expected', function () {
88
- spec.runs(function () {
89
- this.expect('foo').toContain('bar');
90
- });
91
- runner.execute();
92
- fakeTimer.tick(0);
93
-
94
- var resultEl = getResultMessageDiv(body);
95
- expect(resultEl.innerHTML).toMatch(/foo/);
96
- expect(resultEl.innerHTML).toMatch(/bar/);
97
- });
98
- });
99
- });
100
-
101
- describe("failure messages (integration)", function () {
102
- var spec, results, expectationResult;
103
-
104
- beforeEach(function() {
105
- results = {
106
- passed: function() {
107
- return false;
108
- },
109
- getItems: function() {
110
- }};
111
-
112
- var suite1 = new jasmine.Suite(env, "suite 1", null, null);
113
-
114
- spec = {
115
- suite: suite1,
116
- getFullName: function() {
117
- return "foo";
118
- },
119
- results: function() {
120
- return results;
121
- }
122
- };
123
-
124
- trivialReporter.reportRunnerStarting({
125
- env: env,
126
- suites: function() {
127
- return [ suite1 ];
128
- }
129
- });
130
- });
131
-
132
- it("should add the failure message to the DOM (non-toEquals matchers)", function() {
133
- expectationResult = new jasmine.ExpectationResult({
134
- matcherName: "toBeNull", passed: false, message: "Expected 'a' to be null, but it was not"
135
- });
136
-
137
- spyOn(results, 'getItems').andReturn([expectationResult]);
138
-
139
- trivialReporter.reportSpecResults(spec);
140
-
141
- var divs = body.getElementsByTagName("div");
142
- var errorDiv = findElement(divs, 'resultMessage fail');
143
- expect(errorDiv.innerHTML).toEqual("Expected 'a' to be null, but it was not");
144
- });
145
-
146
- it("should add the failure message to the DOM (non-toEquals matchers) html escaping", function() {
147
- expectationResult = new jasmine.ExpectationResult({
148
- matcherName: "toBeNull", passed: false, message: "Expected '1 < 2' to <b>e null, & it was not"
149
- });
150
-
151
- spyOn(results, 'getItems').andReturn([expectationResult]);
152
-
153
- trivialReporter.reportSpecResults(spec);
154
-
155
- var divs = body.getElementsByTagName("div");
156
- var errorDiv = findElement(divs, 'resultMessage fail');
157
- expect(errorDiv.innerHTML).toEqual("Expected '1 &lt; 2' to &lt;b&gt;e null, &amp; it was not");
158
- });
159
- });
160
-
161
- describe("log messages", function() {
162
- it("should appear in the report", function() {
163
- env.describe("suite", function() {
164
- env.it("will have log messages", function() {
165
- this.log("this is a", "multipart log message");
166
- });
167
- });
168
-
169
- env.addReporter(trivialReporter);
170
- env.execute();
171
-
172
- var divs = body.getElementsByTagName("div");
173
- var errorDiv = findElement(divs, 'resultMessage log');
174
- expect(errorDiv.innerHTML).toEqual("this is a multipart log message");
175
- });
176
-
177
- xit("should work on IE without console.log.apply", function() {
178
- });
179
- });
180
-
181
- describe("duplicate example names", function() {
182
- it("should report failures correctly", function() {
183
- var suite1 = env.describe("suite", function() {
184
- env.it("will have log messages", function() {
185
- this.log("this one fails!");
186
- this.expect(true).toBeFalsy();
187
- });
188
- });
189
-
190
- var suite2 = env.describe("suite", function() {
191
- env.it("will have log messages", function() {
192
- this.log("this one passes!");
193
- this.expect(true).toBeTruthy();
194
- });
195
- });
196
-
197
- env.addReporter(trivialReporter);
198
- env.execute();
199
-
200
- var divs = body.getElementsByTagName("div");
201
- var passedSpecDiv = findElement(divs, 'suite passed');
202
- expect(passedSpecDiv.className).toEqual('suite passed');
203
- expect(passedSpecDiv.innerHTML).toContain("this one passes!");
204
- expect(passedSpecDiv.innerHTML).not.toContain("this one fails!");
205
-
206
- var failedSpecDiv = findElement(divs, 'suite failed');
207
- expect(failedSpecDiv.className).toEqual('suite failed');
208
- expect(failedSpecDiv.innerHTML).toContain("this one fails!");
209
- expect(failedSpecDiv.innerHTML).not.toContain("this one passes!");
210
- });
211
- });
212
-
213
- describe('#reportSpecStarting', function() {
214
- var spec1;
215
- beforeEach(function () {
216
- env.describe("suite 1", function() {
217
- spec1 = env.it("spec 1", function() {
218
- });
219
- });
220
- });
221
-
222
- it('DOES NOT log running specs by default', function() {
223
- spyOn(trivialReporter, 'log');
224
-
225
- trivialReporter.reportSpecStarting(spec1);
226
-
227
- expect(trivialReporter.log).not.toHaveBeenCalled();
228
- });
229
-
230
- it('logs running specs when log_running_specs is true', function() {
231
- trivialReporter.logRunningSpecs = true;
232
- spyOn(trivialReporter, 'log');
233
-
234
- trivialReporter.reportSpecStarting(spec1);
235
-
236
- expect(trivialReporter.log).toHaveBeenCalledWith('>> Jasmine Running suite 1 spec 1...');
237
- });
238
- });
239
- });