jasmine-core 2.9.0 → 2.99.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jasmine-core/jasmine-html.js +24 -1
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +50 -6
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -84
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
- data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
- data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
- data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
- data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
- data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
- data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
- data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
- data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
- data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
- data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
- data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,982 +0,0 @@
|
|
1
|
-
describe("New HtmlReporter", function() {
|
2
|
-
it("builds the initial DOM elements, including the title banner", function() {
|
3
|
-
var env = new jasmineUnderTest.Env(),
|
4
|
-
container = document.createElement("div"),
|
5
|
-
getContainer = function() { return container; },
|
6
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
7
|
-
env: env,
|
8
|
-
getContainer: getContainer,
|
9
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
10
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
11
|
-
});
|
12
|
-
reporter.initialize();
|
13
|
-
|
14
|
-
// Main top-level elements
|
15
|
-
expect(container.querySelector("div.jasmine_html-reporter")).toBeTruthy();
|
16
|
-
expect(container.querySelector("div.jasmine-banner")).toBeTruthy();
|
17
|
-
expect(container.querySelector("div.jasmine-alert")).toBeTruthy();
|
18
|
-
expect(container.querySelector("div.jasmine-results")).toBeTruthy();
|
19
|
-
|
20
|
-
expect(container.querySelector("ul.jasmine-symbol-summary")).toBeTruthy();
|
21
|
-
|
22
|
-
// title banner
|
23
|
-
var banner = container.querySelector(".jasmine-banner");
|
24
|
-
|
25
|
-
var title = banner.querySelector("a.jasmine-title");
|
26
|
-
expect(title.getAttribute('href')).toEqual('http://jasmine.github.io/');
|
27
|
-
expect(title.getAttribute('target')).toEqual('_blank');
|
28
|
-
|
29
|
-
var version = banner.querySelector(".jasmine-version"),
|
30
|
-
versionText = 'textContent' in version ? version.textContent : version.innerText;
|
31
|
-
expect(versionText).toEqual(jasmineUnderTest.version);
|
32
|
-
});
|
33
|
-
|
34
|
-
it("builds a single reporter even if initialized multiple times", function() {
|
35
|
-
var env = new jasmineUnderTest.Env(),
|
36
|
-
container = document.createElement("div"),
|
37
|
-
getContainer = function() { return container; },
|
38
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
39
|
-
env: env,
|
40
|
-
getContainer: getContainer,
|
41
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
42
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
43
|
-
});
|
44
|
-
reporter.initialize();
|
45
|
-
reporter.initialize();
|
46
|
-
reporter.initialize();
|
47
|
-
|
48
|
-
expect(container.querySelectorAll("div.jasmine_html-reporter").length).toEqual(1);
|
49
|
-
});
|
50
|
-
|
51
|
-
it("starts the timer when jasmine begins", function() {
|
52
|
-
var env = new jasmine.Env(),
|
53
|
-
startTimerSpy = jasmine.createSpy("start-timer-spy"),
|
54
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
55
|
-
env: env,
|
56
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
57
|
-
timer: { start: startTimerSpy }
|
58
|
-
});
|
59
|
-
|
60
|
-
reporter.jasmineStarted({});
|
61
|
-
|
62
|
-
expect(startTimerSpy).toHaveBeenCalled();
|
63
|
-
});
|
64
|
-
|
65
|
-
describe("when a spec is done", function() {
|
66
|
-
it("logs errors to the console and prints a special symbol if it is an empty spec", function() {
|
67
|
-
if (typeof console === "undefined") {
|
68
|
-
console = { error: function(){} };
|
69
|
-
}
|
70
|
-
|
71
|
-
var env = new jasmineUnderTest.Env(),
|
72
|
-
container = document.createElement('div'),
|
73
|
-
getContainer = function() {return container;},
|
74
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
75
|
-
env: env,
|
76
|
-
getContainer: getContainer,
|
77
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
78
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
79
|
-
});
|
80
|
-
|
81
|
-
spyOn(console, 'error');
|
82
|
-
|
83
|
-
reporter.initialize();
|
84
|
-
|
85
|
-
reporter.specDone({
|
86
|
-
status: "passed",
|
87
|
-
fullName: 'Some Name',
|
88
|
-
passedExpectations: [],
|
89
|
-
failedExpectations: []
|
90
|
-
});
|
91
|
-
expect(console.error).toHaveBeenCalledWith("Spec \'Some Name\' has no expectations.");
|
92
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
93
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-empty");
|
94
|
-
});
|
95
|
-
|
96
|
-
it("reports the status symbol of a disabled spec", function() {
|
97
|
-
var env = new jasmineUnderTest.Env(),
|
98
|
-
container = document.createElement("div"),
|
99
|
-
getContainer = function() { return container; },
|
100
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
101
|
-
env: env,
|
102
|
-
getContainer: getContainer,
|
103
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
104
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
105
|
-
});
|
106
|
-
reporter.initialize();
|
107
|
-
|
108
|
-
reporter.specDone({id: 789, status: "disabled", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
|
109
|
-
|
110
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
111
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-disabled");
|
112
|
-
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
113
|
-
expect(specEl.getAttribute("title")).toEqual("symbols should have titles");
|
114
|
-
});
|
115
|
-
|
116
|
-
it("reports the status symbol of a pending spec", function() {
|
117
|
-
var env = new jasmineUnderTest.Env(),
|
118
|
-
container = document.createElement("div"),
|
119
|
-
getContainer = function() { return container; },
|
120
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
121
|
-
env: env,
|
122
|
-
getContainer: getContainer,
|
123
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
124
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
125
|
-
});
|
126
|
-
reporter.initialize();
|
127
|
-
|
128
|
-
reporter.specDone({id: 789, status: "pending", passedExpectations: [], failedExpectations: []});
|
129
|
-
|
130
|
-
var specEl = container.querySelector('.jasmine-symbol-summary li');
|
131
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-pending");
|
132
|
-
expect(specEl.getAttribute("id")).toEqual("spec_789");
|
133
|
-
});
|
134
|
-
|
135
|
-
it("reports the status symbol of a passing spec", function() {
|
136
|
-
var env = new jasmineUnderTest.Env(),
|
137
|
-
container = document.createElement("div"),
|
138
|
-
getContainer = function() { return container; },
|
139
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
140
|
-
env: env,
|
141
|
-
getContainer: getContainer,
|
142
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
143
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
144
|
-
});
|
145
|
-
reporter.initialize();
|
146
|
-
|
147
|
-
reporter.specDone({id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []});
|
148
|
-
|
149
|
-
var statuses = container.querySelector(".jasmine-symbol-summary");
|
150
|
-
var specEl = statuses.querySelector("li");
|
151
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-passed");
|
152
|
-
expect(specEl.getAttribute("id")).toEqual("spec_123");
|
153
|
-
});
|
154
|
-
|
155
|
-
it("reports the status symbol of a failing spec", function() {
|
156
|
-
var env = new jasmineUnderTest.Env(),
|
157
|
-
container = document.createElement("div"),
|
158
|
-
getContainer = function() { return container; },
|
159
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
160
|
-
env: env,
|
161
|
-
getContainer: getContainer,
|
162
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
163
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
164
|
-
});
|
165
|
-
|
166
|
-
reporter.initialize();
|
167
|
-
|
168
|
-
reporter.specDone({
|
169
|
-
id: 345,
|
170
|
-
status: "failed",
|
171
|
-
failedExpectations: [],
|
172
|
-
passedExpectations: []
|
173
|
-
});
|
174
|
-
|
175
|
-
var specEl = container.querySelector(".jasmine-symbol-summary li");
|
176
|
-
expect(specEl.getAttribute("class")).toEqual("jasmine-failed");
|
177
|
-
expect(specEl.getAttribute("id")).toEqual("spec_345");
|
178
|
-
});
|
179
|
-
});
|
180
|
-
|
181
|
-
describe("when there are suite failures", function () {
|
182
|
-
it("displays the exceptions in their own alert bars", function(){
|
183
|
-
var env = new jasmineUnderTest.Env(),
|
184
|
-
container = document.createElement("div"),
|
185
|
-
getContainer = function() { return container; },
|
186
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
187
|
-
env: env,
|
188
|
-
getContainer: getContainer,
|
189
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
190
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
191
|
-
});
|
192
|
-
|
193
|
-
reporter.initialize();
|
194
|
-
|
195
|
-
reporter.jasmineStarted({});
|
196
|
-
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My After All Exception' }] });
|
197
|
-
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My Other Exception' }] });
|
198
|
-
reporter.jasmineDone({ failedExpectations: [{ message: 'Global After All Failure' }, { message: 'Other Global' }] });
|
199
|
-
|
200
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
201
|
-
|
202
|
-
expect(alertBars.length).toEqual(5);
|
203
|
-
expect(alertBars[1].innerHTML).toMatch(/My After All Exception/);
|
204
|
-
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-errored');
|
205
|
-
expect(alertBars[2].innerHTML).toMatch(/My Other Exception/);
|
206
|
-
expect(alertBars[3].innerHTML).toMatch(/Global After All Failure/);
|
207
|
-
expect(alertBars[4].innerHTML).toMatch(/Other Global/);
|
208
|
-
});
|
209
|
-
});
|
210
|
-
|
211
|
-
describe("when Jasmine is done", function() {
|
212
|
-
it("adds a warning to the link title of specs that have no expectations", function() {
|
213
|
-
if (!window.console) {
|
214
|
-
window.console = { error: function(){} };
|
215
|
-
}
|
216
|
-
var env = new jasmineUnderTest.Env(),
|
217
|
-
container = document.createElement('div'),
|
218
|
-
getContainer = function() {return container;},
|
219
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
220
|
-
env: env,
|
221
|
-
getContainer: getContainer,
|
222
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
223
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
224
|
-
});
|
225
|
-
|
226
|
-
spyOn(console, 'error');
|
227
|
-
|
228
|
-
reporter.initialize();
|
229
|
-
reporter.jasmineStarted({});
|
230
|
-
reporter.suiteStarted({id: 1});
|
231
|
-
reporter.specStarted({id: 1, passedExpectations: [], failedExpectations: []});
|
232
|
-
reporter.specDone({
|
233
|
-
id: 1,
|
234
|
-
status: 'passed',
|
235
|
-
description: 'Spec Description',
|
236
|
-
passedExpectations: [],
|
237
|
-
failedExpectations: []
|
238
|
-
});
|
239
|
-
reporter.suiteDone({id: 1});
|
240
|
-
reporter.jasmineDone({});
|
241
|
-
|
242
|
-
var summary = container.querySelector('.jasmine-summary');
|
243
|
-
var suite = summary.childNodes[0];
|
244
|
-
var specs = suite.childNodes[1];
|
245
|
-
var spec = specs.childNodes[0];
|
246
|
-
var specLink = spec.childNodes[0];
|
247
|
-
expect(specLink.innerHTML).toMatch(/SPEC HAS NO EXPECTATIONS/);
|
248
|
-
});
|
249
|
-
|
250
|
-
it("reports the run time", function() {
|
251
|
-
var env = new jasmineUnderTest.Env(),
|
252
|
-
container = document.createElement("div"),
|
253
|
-
timer = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
254
|
-
getContainer = function() { return container; },
|
255
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
256
|
-
env: env,
|
257
|
-
getContainer: getContainer,
|
258
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
259
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
260
|
-
timer: timer
|
261
|
-
});
|
262
|
-
|
263
|
-
reporter.initialize();
|
264
|
-
|
265
|
-
reporter.jasmineStarted({});
|
266
|
-
|
267
|
-
timer.elapsed.and.returnValue(100);
|
268
|
-
reporter.jasmineDone();
|
269
|
-
|
270
|
-
var duration = container.querySelector(".jasmine-alert .jasmine-duration");
|
271
|
-
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
272
|
-
});
|
273
|
-
|
274
|
-
it("reports the suite and spec names with status", function() {
|
275
|
-
var env = new jasmineUnderTest.Env(),
|
276
|
-
container = document.createElement("div"),
|
277
|
-
getContainer = function() { return container; },
|
278
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
279
|
-
env: env,
|
280
|
-
getContainer: getContainer,
|
281
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
282
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
283
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
284
|
-
});
|
285
|
-
reporter.initialize();
|
286
|
-
|
287
|
-
reporter.jasmineStarted({});
|
288
|
-
reporter.suiteStarted({
|
289
|
-
id: 1,
|
290
|
-
description: "A Suite",
|
291
|
-
fullName: "A Suite"
|
292
|
-
});
|
293
|
-
|
294
|
-
var specResult = {
|
295
|
-
id: 123,
|
296
|
-
description: "with a spec",
|
297
|
-
fullName: "A Suite with a spec",
|
298
|
-
status: "passed",
|
299
|
-
failedExpectations: [],
|
300
|
-
passedExpectations: [{passed: true}]
|
301
|
-
};
|
302
|
-
reporter.specStarted(specResult);
|
303
|
-
reporter.specDone(specResult);
|
304
|
-
|
305
|
-
reporter.suiteStarted({
|
306
|
-
id: 2,
|
307
|
-
description: "inner suite",
|
308
|
-
fullName: "A Suite inner suite"
|
309
|
-
});
|
310
|
-
|
311
|
-
var specResult = {
|
312
|
-
id: 124,
|
313
|
-
description: "with another spec",
|
314
|
-
fullName: "A Suite inner suite with another spec",
|
315
|
-
status: "passed",
|
316
|
-
failedExpectations: [],
|
317
|
-
passedExpectations: [{passed: true}]
|
318
|
-
};
|
319
|
-
reporter.specStarted(specResult);
|
320
|
-
reporter.specDone(specResult);
|
321
|
-
|
322
|
-
reporter.suiteDone({id: 2});
|
323
|
-
|
324
|
-
specResult = {
|
325
|
-
id: 209,
|
326
|
-
description: "with a failing spec",
|
327
|
-
fullName: "A Suite inner with a failing spec",
|
328
|
-
status: "failed",
|
329
|
-
failedExpectations: [{}],
|
330
|
-
passedExpectations: []
|
331
|
-
};
|
332
|
-
reporter.specStarted(specResult);
|
333
|
-
reporter.specDone(specResult);
|
334
|
-
|
335
|
-
reporter.suiteDone({id: 1});
|
336
|
-
|
337
|
-
reporter.jasmineDone({});
|
338
|
-
var summary = container.querySelector(".jasmine-summary");
|
339
|
-
|
340
|
-
expect(summary.childNodes.length).toEqual(1);
|
341
|
-
|
342
|
-
var outerSuite = summary.childNodes[0];
|
343
|
-
expect(outerSuite.childNodes.length).toEqual(4);
|
344
|
-
|
345
|
-
var classes = [];
|
346
|
-
for (var i = 0; i < outerSuite.childNodes.length; i++) {
|
347
|
-
var node = outerSuite.childNodes[i];
|
348
|
-
classes.push(node.getAttribute("class"));
|
349
|
-
}
|
350
|
-
expect(classes).toEqual(["jasmine-suite-detail", "jasmine-specs", "jasmine-suite", "jasmine-specs"]);
|
351
|
-
|
352
|
-
var suiteDetail = outerSuite.childNodes[0];
|
353
|
-
var suiteLink = suiteDetail.childNodes[0];
|
354
|
-
expect(suiteLink.innerHTML).toEqual("A Suite");
|
355
|
-
expect(suiteLink.getAttribute('href')).toEqual("?foo=bar&spec=A Suite");
|
356
|
-
|
357
|
-
var specs = outerSuite.childNodes[1];
|
358
|
-
var spec = specs.childNodes[0];
|
359
|
-
expect(spec.getAttribute("class")).toEqual("jasmine-passed");
|
360
|
-
expect(spec.getAttribute("id")).toEqual("spec-123");
|
361
|
-
|
362
|
-
var specLink = spec.childNodes[0];
|
363
|
-
expect(specLink.innerHTML).toEqual("with a spec");
|
364
|
-
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=A Suite with a spec");
|
365
|
-
// expect(specLink.getAttribute("title")).toEqual("A Suite with a spec");
|
366
|
-
});
|
367
|
-
|
368
|
-
it("has an options menu", function() {
|
369
|
-
var env = new jasmineUnderTest.Env(),
|
370
|
-
container = document.createElement("div"),
|
371
|
-
getContainer = function() {
|
372
|
-
return container;
|
373
|
-
},
|
374
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
375
|
-
env: env,
|
376
|
-
getContainer: getContainer,
|
377
|
-
createElement: function() {
|
378
|
-
return document.createElement.apply(document, arguments);
|
379
|
-
},
|
380
|
-
createTextNode: function() {
|
381
|
-
return document.createTextNode.apply(document, arguments);
|
382
|
-
}
|
383
|
-
});
|
384
|
-
|
385
|
-
reporter.initialize();
|
386
|
-
reporter.jasmineDone({});
|
387
|
-
|
388
|
-
var trigger = container.querySelector('.jasmine-run-options .jasmine-trigger'),
|
389
|
-
payload = container.querySelector('.jasmine-run-options .jasmine-payload');
|
390
|
-
|
391
|
-
expect(payload.className).not.toContain('jasmine-open');
|
392
|
-
|
393
|
-
trigger.onclick();
|
394
|
-
|
395
|
-
expect(payload.className).toContain('jasmine-open');
|
396
|
-
|
397
|
-
trigger.onclick();
|
398
|
-
|
399
|
-
expect(payload.className).not.toContain('jasmine-open');
|
400
|
-
});
|
401
|
-
|
402
|
-
describe("UI for raising/catching exceptions", function() {
|
403
|
-
it("should be unchecked if the env is catching", function() {
|
404
|
-
var env = new jasmineUnderTest.Env(),
|
405
|
-
container = document.createElement("div"),
|
406
|
-
getContainer = function() {
|
407
|
-
return container;
|
408
|
-
},
|
409
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
410
|
-
env: env,
|
411
|
-
getContainer: getContainer,
|
412
|
-
createElement: function() {
|
413
|
-
return document.createElement.apply(document, arguments);
|
414
|
-
},
|
415
|
-
createTextNode: function() {
|
416
|
-
return document.createTextNode.apply(document, arguments);
|
417
|
-
}
|
418
|
-
});
|
419
|
-
|
420
|
-
reporter.initialize();
|
421
|
-
reporter.jasmineDone({});
|
422
|
-
|
423
|
-
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
424
|
-
expect(raisingExceptionsUI.checked).toBe(false);
|
425
|
-
});
|
426
|
-
|
427
|
-
it("should be checked if the env is not catching", function() {
|
428
|
-
var env = new jasmineUnderTest.Env(),
|
429
|
-
container = document.createElement("div"),
|
430
|
-
getContainer = function() {
|
431
|
-
return container;
|
432
|
-
},
|
433
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
434
|
-
env: env,
|
435
|
-
getContainer: getContainer,
|
436
|
-
createElement: function() {
|
437
|
-
return document.createElement.apply(document, arguments);
|
438
|
-
},
|
439
|
-
createTextNode: function() {
|
440
|
-
return document.createTextNode.apply(document, arguments);
|
441
|
-
}
|
442
|
-
});
|
443
|
-
|
444
|
-
reporter.initialize();
|
445
|
-
env.catchExceptions(false);
|
446
|
-
reporter.jasmineDone({});
|
447
|
-
|
448
|
-
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
449
|
-
expect(raisingExceptionsUI.checked).toBe(true);
|
450
|
-
});
|
451
|
-
|
452
|
-
it("should affect the query param for catching exceptions", function() {
|
453
|
-
var env = new jasmineUnderTest.Env(),
|
454
|
-
container = document.createElement("div"),
|
455
|
-
exceptionsClickHandler = jasmine.createSpy("raise exceptions checked"),
|
456
|
-
getContainer = function() {
|
457
|
-
return container;
|
458
|
-
},
|
459
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
460
|
-
env: env,
|
461
|
-
getContainer: getContainer,
|
462
|
-
onRaiseExceptionsClick: exceptionsClickHandler,
|
463
|
-
createElement: function() {
|
464
|
-
return document.createElement.apply(document, arguments);
|
465
|
-
},
|
466
|
-
createTextNode: function() {
|
467
|
-
return document.createTextNode.apply(document, arguments);
|
468
|
-
}
|
469
|
-
});
|
470
|
-
|
471
|
-
reporter.initialize();
|
472
|
-
reporter.jasmineDone({});
|
473
|
-
|
474
|
-
var input = container.querySelector(".jasmine-raise");
|
475
|
-
input.click();
|
476
|
-
expect(exceptionsClickHandler).toHaveBeenCalled();
|
477
|
-
});
|
478
|
-
});
|
479
|
-
|
480
|
-
describe("UI for throwing errors on expectation failures", function() {
|
481
|
-
it("should be unchecked if not throwing", function() {
|
482
|
-
var env = new jasmineUnderTest.Env(),
|
483
|
-
container = document.createElement("div"),
|
484
|
-
getContainer = function() {
|
485
|
-
return container;
|
486
|
-
},
|
487
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
488
|
-
env: env,
|
489
|
-
getContainer: getContainer,
|
490
|
-
createElement: function() {
|
491
|
-
return document.createElement.apply(document, arguments);
|
492
|
-
},
|
493
|
-
createTextNode: function() {
|
494
|
-
return document.createTextNode.apply(document, arguments);
|
495
|
-
}
|
496
|
-
});
|
497
|
-
|
498
|
-
reporter.initialize();
|
499
|
-
reporter.jasmineDone({});
|
500
|
-
|
501
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
502
|
-
expect(throwingExpectationsUI.checked).toBe(false);
|
503
|
-
});
|
504
|
-
|
505
|
-
it("should be checked if throwing", function() {
|
506
|
-
var env = new jasmineUnderTest.Env(),
|
507
|
-
container = document.createElement("div"),
|
508
|
-
getContainer = function() {
|
509
|
-
return container;
|
510
|
-
},
|
511
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
512
|
-
env: env,
|
513
|
-
getContainer: getContainer,
|
514
|
-
createElement: function() {
|
515
|
-
return document.createElement.apply(document, arguments);
|
516
|
-
},
|
517
|
-
createTextNode: function() {
|
518
|
-
return document.createTextNode.apply(document, arguments);
|
519
|
-
}
|
520
|
-
});
|
521
|
-
|
522
|
-
env.throwOnExpectationFailure(true);
|
523
|
-
|
524
|
-
reporter.initialize();
|
525
|
-
reporter.jasmineDone({});
|
526
|
-
|
527
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
528
|
-
expect(throwingExpectationsUI.checked).toBe(true);
|
529
|
-
});
|
530
|
-
|
531
|
-
it("should affect the query param for throw expectation failures", function() {
|
532
|
-
var env = new jasmineUnderTest.Env(),
|
533
|
-
container = document.createElement("div"),
|
534
|
-
throwingExceptionHandler = jasmine.createSpy('throwingExceptions'),
|
535
|
-
getContainer = function() {
|
536
|
-
return container;
|
537
|
-
},
|
538
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
539
|
-
env: env,
|
540
|
-
getContainer: getContainer,
|
541
|
-
onThrowExpectationsClick: throwingExceptionHandler,
|
542
|
-
createElement: function() {
|
543
|
-
return document.createElement.apply(document, arguments);
|
544
|
-
},
|
545
|
-
createTextNode: function() {
|
546
|
-
return document.createTextNode.apply(document, arguments);
|
547
|
-
}
|
548
|
-
});
|
549
|
-
|
550
|
-
reporter.initialize();
|
551
|
-
reporter.jasmineDone({});
|
552
|
-
|
553
|
-
var throwingExpectationsUI = container.querySelector(".jasmine-throw");
|
554
|
-
throwingExpectationsUI.click();
|
555
|
-
|
556
|
-
expect(throwingExceptionHandler).toHaveBeenCalled();
|
557
|
-
});
|
558
|
-
});
|
559
|
-
|
560
|
-
describe("UI for running tests in random order", function() {
|
561
|
-
it("should be unchecked if not randomizing", function() {
|
562
|
-
var env = new jasmineUnderTest.Env(),
|
563
|
-
container = document.createElement("div"),
|
564
|
-
getContainer = function() {
|
565
|
-
return container;
|
566
|
-
},
|
567
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
568
|
-
env: env,
|
569
|
-
getContainer: getContainer,
|
570
|
-
createElement: function() {
|
571
|
-
return document.createElement.apply(document, arguments);
|
572
|
-
},
|
573
|
-
createTextNode: function() {
|
574
|
-
return document.createTextNode.apply(document, arguments);
|
575
|
-
}
|
576
|
-
});
|
577
|
-
|
578
|
-
reporter.initialize();
|
579
|
-
reporter.jasmineDone({});
|
580
|
-
|
581
|
-
var randomUI = container.querySelector(".jasmine-random");
|
582
|
-
expect(randomUI.checked).toBe(false);
|
583
|
-
});
|
584
|
-
|
585
|
-
it("should be checked if randomizing", function() {
|
586
|
-
var env = new jasmineUnderTest.Env(),
|
587
|
-
container = document.createElement("div"),
|
588
|
-
getContainer = function() {
|
589
|
-
return container;
|
590
|
-
},
|
591
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
592
|
-
env: env,
|
593
|
-
getContainer: getContainer,
|
594
|
-
createElement: function() {
|
595
|
-
return document.createElement.apply(document, arguments);
|
596
|
-
},
|
597
|
-
createTextNode: function() {
|
598
|
-
return document.createTextNode.apply(document, arguments);
|
599
|
-
}
|
600
|
-
});
|
601
|
-
|
602
|
-
env.randomizeTests(true);
|
603
|
-
reporter.initialize();
|
604
|
-
reporter.jasmineDone({});
|
605
|
-
|
606
|
-
var randomUI = container.querySelector(".jasmine-random");
|
607
|
-
expect(randomUI.checked).toBe(true);
|
608
|
-
});
|
609
|
-
|
610
|
-
it("should affect the query param for random tests", function() {
|
611
|
-
var env = new jasmineUnderTest.Env(),
|
612
|
-
container = document.createElement("div"),
|
613
|
-
randomHandler = jasmine.createSpy('randomHandler'),
|
614
|
-
getContainer = function() {
|
615
|
-
return container;
|
616
|
-
},
|
617
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
618
|
-
env: env,
|
619
|
-
getContainer: getContainer,
|
620
|
-
onRandomClick: randomHandler,
|
621
|
-
createElement: function() {
|
622
|
-
return document.createElement.apply(document, arguments);
|
623
|
-
},
|
624
|
-
createTextNode: function() {
|
625
|
-
return document.createTextNode.apply(document, arguments);
|
626
|
-
}
|
627
|
-
});
|
628
|
-
|
629
|
-
reporter.initialize();
|
630
|
-
reporter.jasmineDone({});
|
631
|
-
|
632
|
-
var randomUI = container.querySelector(".jasmine-random");
|
633
|
-
randomUI.click();
|
634
|
-
|
635
|
-
expect(randomHandler).toHaveBeenCalled();
|
636
|
-
});
|
637
|
-
|
638
|
-
it("should show the seed bar if randomizing", function() {
|
639
|
-
var env = new jasmineUnderTest.Env(),
|
640
|
-
container = document.createElement("div"),
|
641
|
-
getContainer = function() {
|
642
|
-
return container;
|
643
|
-
},
|
644
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
645
|
-
env: env,
|
646
|
-
getContainer: getContainer,
|
647
|
-
createElement: function() {
|
648
|
-
return document.createElement.apply(document, arguments);
|
649
|
-
},
|
650
|
-
createTextNode: function() {
|
651
|
-
return document.createTextNode.apply(document, arguments);
|
652
|
-
}
|
653
|
-
});
|
654
|
-
|
655
|
-
reporter.initialize();
|
656
|
-
reporter.jasmineDone({
|
657
|
-
order: {
|
658
|
-
random: true,
|
659
|
-
seed: '424242'
|
660
|
-
}
|
661
|
-
});
|
662
|
-
|
663
|
-
var seedBar = container.querySelector(".jasmine-seed-bar");
|
664
|
-
var seedBarText = 'textContent' in seedBar ? seedBar.textContent : seedBar.innerText;
|
665
|
-
expect(seedBarText).toBe(', randomized with seed 424242');
|
666
|
-
var seedLink = container.querySelector(".jasmine-seed-bar a");
|
667
|
-
expect(seedLink.getAttribute('href')).toBe('?seed=424242');
|
668
|
-
});
|
669
|
-
|
670
|
-
it("should not show the current seed bar if not randomizing", function() {
|
671
|
-
var env = new jasmineUnderTest.Env(),
|
672
|
-
container = document.createElement("div"),
|
673
|
-
getContainer = function() {
|
674
|
-
return container;
|
675
|
-
},
|
676
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
677
|
-
env: env,
|
678
|
-
getContainer: getContainer,
|
679
|
-
createElement: function() {
|
680
|
-
return document.createElement.apply(document, arguments);
|
681
|
-
},
|
682
|
-
createTextNode: function() {
|
683
|
-
return document.createTextNode.apply(document, arguments);
|
684
|
-
}
|
685
|
-
});
|
686
|
-
|
687
|
-
reporter.initialize();
|
688
|
-
reporter.jasmineDone();
|
689
|
-
|
690
|
-
var seedBar = container.querySelector(".jasmine-seed-bar");
|
691
|
-
expect(seedBar).toBeNull();
|
692
|
-
});
|
693
|
-
|
694
|
-
it("should include non-spec query params in the jasmine-skipped link when present", function(){
|
695
|
-
var env = new jasmineUnderTest.Env(),
|
696
|
-
container = document.createElement("div"),
|
697
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
698
|
-
env: env,
|
699
|
-
getContainer: function() { return container; },
|
700
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
701
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
702
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
703
|
-
});
|
704
|
-
|
705
|
-
reporter.initialize();
|
706
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
707
|
-
reporter.jasmineDone({ order: { random: true } });
|
708
|
-
|
709
|
-
var skippedLink = container.querySelector(".jasmine-skipped a");
|
710
|
-
expect(skippedLink.getAttribute('href')).toEqual('?foo=bar&spec=');
|
711
|
-
});
|
712
|
-
});
|
713
|
-
|
714
|
-
it("shows a message if no specs are run", function(){
|
715
|
-
var env, container, reporter;
|
716
|
-
env = new jasmineUnderTest.Env();
|
717
|
-
container = document.createElement("div");
|
718
|
-
var getContainer = function() { return container; },
|
719
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
720
|
-
env: env,
|
721
|
-
getContainer: getContainer,
|
722
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
723
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
724
|
-
});
|
725
|
-
reporter.initialize();
|
726
|
-
|
727
|
-
reporter.jasmineStarted({});
|
728
|
-
reporter.jasmineDone({});
|
729
|
-
|
730
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
731
|
-
expect(alertBars[0].getAttribute('class')).toMatch(/jasmine-skipped/);
|
732
|
-
expect(alertBars[0].innerHTML).toMatch(/No specs found/);
|
733
|
-
});
|
734
|
-
|
735
|
-
describe("and all specs pass", function() {
|
736
|
-
var env, container, reporter;
|
737
|
-
beforeEach(function() {
|
738
|
-
env = new jasmineUnderTest.Env();
|
739
|
-
container = document.createElement("div");
|
740
|
-
var getContainer = function() { return container; },
|
741
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
742
|
-
env: env,
|
743
|
-
getContainer: getContainer,
|
744
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
745
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
746
|
-
});
|
747
|
-
reporter.initialize();
|
748
|
-
|
749
|
-
reporter.jasmineStarted({ totalSpecsDefined: 2 });
|
750
|
-
reporter.specDone({
|
751
|
-
id: 123,
|
752
|
-
description: "with a spec",
|
753
|
-
fullName: "A Suite with a spec",
|
754
|
-
status: "passed",
|
755
|
-
passedExpectations: [{passed: true}],
|
756
|
-
failedExpectations: []
|
757
|
-
});
|
758
|
-
reporter.specDone({
|
759
|
-
id: 124,
|
760
|
-
description: "with another spec",
|
761
|
-
fullName: "A Suite inner suite with another spec",
|
762
|
-
status: "passed",
|
763
|
-
passedExpectations: [{passed: true}],
|
764
|
-
failedExpectations: []
|
765
|
-
});
|
766
|
-
reporter.jasmineDone({});
|
767
|
-
});
|
768
|
-
|
769
|
-
it("reports the specs counts", function() {
|
770
|
-
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
771
|
-
|
772
|
-
expect(alertBars.length).toEqual(1);
|
773
|
-
expect(alertBars[0].getAttribute('class')).toMatch(/jasmine-passed/);
|
774
|
-
expect(alertBars[0].innerHTML).toMatch(/2 specs, 0 failures/);
|
775
|
-
});
|
776
|
-
|
777
|
-
it("reports no failure details", function() {
|
778
|
-
var specFailure = container.querySelector(".jasmine-failures");
|
779
|
-
|
780
|
-
expect(specFailure.childNodes.length).toEqual(0);
|
781
|
-
});
|
782
|
-
|
783
|
-
it("reports no pending specs", function() {
|
784
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
785
|
-
|
786
|
-
expect(alertBar.innerHTML).not.toMatch(/pending spec[s]/);
|
787
|
-
});
|
788
|
-
});
|
789
|
-
|
790
|
-
describe("and there are disabled specs", function() {
|
791
|
-
var env, container, reporter, reporterConfig, specStatus;
|
792
|
-
beforeEach(function() {
|
793
|
-
env = new jasmineUnderTest.Env();
|
794
|
-
container = document.createElement("div");
|
795
|
-
reporterConfig = {
|
796
|
-
env: env,
|
797
|
-
getContainer: function() { return container; },
|
798
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
799
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
800
|
-
};
|
801
|
-
specStatus = {
|
802
|
-
id: 123,
|
803
|
-
description: "with a disabled spec",
|
804
|
-
fullName: "A Suite with a disabled spec",
|
805
|
-
status: "disabled",
|
806
|
-
passedExpectations: [],
|
807
|
-
failedExpectations: []
|
808
|
-
};
|
809
|
-
});
|
810
|
-
|
811
|
-
describe("when the specs are not filtered", function() {
|
812
|
-
beforeEach(function() {
|
813
|
-
reporterConfig.filterSpecs = false;
|
814
|
-
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
815
|
-
reporter.initialize();
|
816
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
817
|
-
reporter.specStarted(specStatus);
|
818
|
-
reporter.specDone(specStatus);
|
819
|
-
reporter.jasmineDone({});
|
820
|
-
});
|
821
|
-
|
822
|
-
it("shows the disabled spec in the spec list", function() {
|
823
|
-
var specList = container.querySelector(".jasmine-summary");
|
824
|
-
|
825
|
-
expect(specList.innerHTML).toContain('with a disabled spec');
|
826
|
-
});
|
827
|
-
});
|
828
|
-
|
829
|
-
describe("when the specs are filtered", function() {
|
830
|
-
beforeEach(function() {
|
831
|
-
reporterConfig.filterSpecs = true;
|
832
|
-
reporter = new jasmineUnderTest.HtmlReporter(reporterConfig);
|
833
|
-
reporter.initialize();
|
834
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
835
|
-
reporter.specStarted(specStatus);
|
836
|
-
reporter.specDone(specStatus);
|
837
|
-
reporter.jasmineDone({});
|
838
|
-
});
|
839
|
-
|
840
|
-
it("doesn't show the disabled spec in the spec list", function() {
|
841
|
-
var specList = container.querySelector(".jasmine-summary");
|
842
|
-
|
843
|
-
expect(specList.innerHTML).toEqual('');
|
844
|
-
});
|
845
|
-
});
|
846
|
-
});
|
847
|
-
|
848
|
-
describe("and there are pending specs", function() {
|
849
|
-
var env, container, reporter;
|
850
|
-
beforeEach(function() {
|
851
|
-
env = new jasmineUnderTest.Env();
|
852
|
-
container = document.createElement("div");
|
853
|
-
var getContainer = function() { return container; };
|
854
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
855
|
-
env: env,
|
856
|
-
getContainer: getContainer,
|
857
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
858
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
859
|
-
});
|
860
|
-
reporter.initialize();
|
861
|
-
|
862
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
863
|
-
var specStatus = {
|
864
|
-
id: 123,
|
865
|
-
description: "with a spec",
|
866
|
-
fullName: "A Suite with a spec",
|
867
|
-
status: "pending",
|
868
|
-
passedExpectations: [],
|
869
|
-
failedExpectations: [],
|
870
|
-
pendingReason: "my custom pending reason"
|
871
|
-
};
|
872
|
-
reporter.specStarted(specStatus);
|
873
|
-
reporter.specDone(specStatus);
|
874
|
-
reporter.jasmineDone({});
|
875
|
-
});
|
876
|
-
|
877
|
-
it("reports the pending specs count", function() {
|
878
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
879
|
-
|
880
|
-
expect(alertBar.innerHTML).toMatch(/1 spec, 0 failures, 1 pending spec/);
|
881
|
-
});
|
882
|
-
|
883
|
-
it("reports no failure details", function() {
|
884
|
-
var specFailure = container.querySelector(".jasmine-failures");
|
885
|
-
|
886
|
-
expect(specFailure.childNodes.length).toEqual(0);
|
887
|
-
});
|
888
|
-
|
889
|
-
it("displays the custom pending reason", function() {
|
890
|
-
var pendingDetails = container.querySelector(".jasmine-summary .jasmine-pending");
|
891
|
-
|
892
|
-
expect(pendingDetails.innerHTML).toContain("my custom pending reason");
|
893
|
-
});
|
894
|
-
});
|
895
|
-
|
896
|
-
describe("and some tests fail", function() {
|
897
|
-
var env, container, reporter;
|
898
|
-
|
899
|
-
beforeEach(function() {
|
900
|
-
env = new jasmineUnderTest.Env();
|
901
|
-
container = document.createElement("div");
|
902
|
-
var getContainer = function() { return container; }
|
903
|
-
reporter = new jasmineUnderTest.HtmlReporter({
|
904
|
-
env: env,
|
905
|
-
getContainer: getContainer,
|
906
|
-
createElement: function() { return document.createElement.apply(document, arguments); },
|
907
|
-
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
908
|
-
addToExistingQueryString: function(key, value) { return "?foo=bar&" + key + "=" + value; }
|
909
|
-
});
|
910
|
-
reporter.initialize();
|
911
|
-
|
912
|
-
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
913
|
-
|
914
|
-
var passingResult = {id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []};
|
915
|
-
reporter.specStarted(passingResult);
|
916
|
-
reporter.specDone(passingResult);
|
917
|
-
|
918
|
-
var failingResult = {
|
919
|
-
id: 124,
|
920
|
-
status: "failed",
|
921
|
-
description: "a failing spec",
|
922
|
-
fullName: "a suite with a failing spec",
|
923
|
-
passedExpectations: [],
|
924
|
-
failedExpectations: [
|
925
|
-
{
|
926
|
-
message: "a failure message",
|
927
|
-
stack: "a stack trace"
|
928
|
-
}
|
929
|
-
]
|
930
|
-
};
|
931
|
-
reporter.specStarted(failingResult);
|
932
|
-
reporter.specDone(failingResult);
|
933
|
-
reporter.jasmineDone({});
|
934
|
-
});
|
935
|
-
|
936
|
-
it("reports the specs counts", function() {
|
937
|
-
var alertBar = container.querySelector(".jasmine-alert .jasmine-bar");
|
938
|
-
|
939
|
-
expect(alertBar.getAttribute('class')).toMatch(/jasmine-failed/);
|
940
|
-
expect(alertBar.innerHTML).toMatch(/2 specs, 1 failure/);
|
941
|
-
});
|
942
|
-
|
943
|
-
it("reports failure messages and stack traces", function() {
|
944
|
-
var specFailures = container.querySelector(".jasmine-failures");
|
945
|
-
|
946
|
-
var failure = specFailures.childNodes[0];
|
947
|
-
expect(failure.getAttribute("class")).toMatch(/jasmine-failed/);
|
948
|
-
expect(failure.getAttribute("class")).toMatch(/jasmine-spec-detail/);
|
949
|
-
|
950
|
-
var specDiv = failure.childNodes[0];
|
951
|
-
expect(specDiv.getAttribute("class")).toEqual("jasmine-description");
|
952
|
-
|
953
|
-
var specLink = specDiv.childNodes[0];
|
954
|
-
expect(specLink.getAttribute("title")).toEqual("a suite with a failing spec");
|
955
|
-
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=a suite with a failing spec");
|
956
|
-
|
957
|
-
var message = failure.childNodes[1].childNodes[0];
|
958
|
-
expect(message.getAttribute("class")).toEqual("jasmine-result-message");
|
959
|
-
expect(message.innerHTML).toEqual("a failure message");
|
960
|
-
|
961
|
-
var stackTrace = failure.childNodes[1].childNodes[1];
|
962
|
-
expect(stackTrace.getAttribute("class")).toEqual("jasmine-stack-trace");
|
963
|
-
expect(stackTrace.innerHTML).toEqual("a stack trace");
|
964
|
-
});
|
965
|
-
|
966
|
-
it("allows switching between failure details and the spec summary", function() {
|
967
|
-
var menuBar = container.querySelectorAll(".jasmine-bar")[1];
|
968
|
-
|
969
|
-
expect(menuBar.getAttribute("class")).not.toMatch(/hidden/);
|
970
|
-
|
971
|
-
var link = menuBar.querySelector('a');
|
972
|
-
expect(link.innerHTML).toEqual("Failures");
|
973
|
-
expect(link.getAttribute("href")).toEqual("#");
|
974
|
-
});
|
975
|
-
|
976
|
-
it("sets the reporter to 'Failures List' mode", function() {
|
977
|
-
var reporterNode = container.querySelector(".jasmine_html-reporter");
|
978
|
-
expect(reporterNode.getAttribute("class")).toMatch("jasmine-failure-list");
|
979
|
-
});
|
980
|
-
});
|
981
|
-
});
|
982
|
-
});
|