jasmine-core 1.1.0 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,11 +10,11 @@
10
10
  <script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine.js"></script>
11
11
  <script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine-html.js"></script>
12
12
 
13
- <!-- include spec files here... -->
13
+ <!-- include source files here... -->
14
14
  <script type="text/javascript" src="spec/SpecHelper.js"></script>
15
15
  <script type="text/javascript" src="spec/PlayerSpec.js"></script>
16
16
 
17
- <!-- include source files here... -->
17
+ <!-- include spec files here... -->
18
18
  <script type="text/javascript" src="src/Player.js"></script>
19
19
  <script type="text/javascript" src="src/Song.js"></script>
20
20
 
@@ -1,7 +1,478 @@
1
+ jasmine.HtmlReporterHelpers = {};
2
+
3
+ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
4
+ var el = document.createElement(type);
5
+
6
+ for (var i = 2; i < arguments.length; i++) {
7
+ var child = arguments[i];
8
+
9
+ if (typeof child === 'string') {
10
+ el.appendChild(document.createTextNode(child));
11
+ } else {
12
+ if (child) {
13
+ el.appendChild(child);
14
+ }
15
+ }
16
+ }
17
+
18
+ for (var attr in attrs) {
19
+ if (attr == "className") {
20
+ el[attr] = attrs[attr];
21
+ } else {
22
+ el.setAttribute(attr, attrs[attr]);
23
+ }
24
+ }
25
+
26
+ return el;
27
+ };
28
+
29
+ jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
30
+ var results = child.results();
31
+ var status = results.passed() ? 'passed' : 'failed';
32
+ if (results.skipped) {
33
+ status = 'skipped';
34
+ }
35
+
36
+ return status;
37
+ };
38
+
39
+ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
40
+ var parentDiv = this.dom.summary;
41
+ var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
42
+ var parent = child[parentSuite];
43
+
44
+ if (parent) {
45
+ if (typeof this.views.suites[parent.id] == 'undefined') {
46
+ this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
47
+ }
48
+ parentDiv = this.views.suites[parent.id].element;
49
+ }
50
+
51
+ parentDiv.appendChild(childElement);
52
+ };
53
+
54
+
55
+ jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
56
+ for(var fn in jasmine.HtmlReporterHelpers) {
57
+ ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
58
+ }
59
+ };
60
+
61
+ jasmine.HtmlReporter = function(_doc) {
62
+ var self = this;
63
+ var doc = _doc || window.document;
64
+
65
+ var reporterView;
66
+
67
+ var dom = {};
68
+
69
+ // Jasmine Reporter Public Interface
70
+ self.logRunningSpecs = false;
71
+
72
+ self.reportRunnerStarting = function(runner) {
73
+ var specs = runner.specs() || [];
74
+
75
+ if (specs.length == 0) {
76
+ return;
77
+ }
78
+
79
+ createReporterDom(runner.env.versionString());
80
+ doc.body.appendChild(dom.reporter);
81
+
82
+ reporterView = new jasmine.HtmlReporter.ReporterView(dom);
83
+ reporterView.addSpecs(specs, self.specFilter);
84
+ };
85
+
86
+ self.reportRunnerResults = function(runner) {
87
+ reporterView.complete();
88
+ };
89
+
90
+ self.reportSuiteResults = function(suite) {
91
+ reporterView.suiteComplete(suite);
92
+ };
93
+
94
+ self.reportSpecStarting = function(spec) {
95
+ if (self.logRunningSpecs) {
96
+ self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
97
+ }
98
+ };
99
+
100
+ self.reportSpecResults = function(spec) {
101
+ reporterView.specComplete(spec);
102
+ };
103
+
104
+ self.log = function() {
105
+ var console = jasmine.getGlobal().console;
106
+ if (console && console.log) {
107
+ if (console.log.apply) {
108
+ console.log.apply(console, arguments);
109
+ } else {
110
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
111
+ }
112
+ }
113
+ };
114
+
115
+ self.specFilter = function(spec) {
116
+ if (!focusedSpecName()) {
117
+ return true;
118
+ }
119
+
120
+ return spec.getFullName().indexOf(focusedSpecName()) === 0;
121
+ };
122
+
123
+ return self;
124
+
125
+ function focusedSpecName() {
126
+ var specName;
127
+
128
+ (function memoizeFocusedSpec() {
129
+ if (specName) {
130
+ return;
131
+ }
132
+
133
+ var paramMap = [];
134
+ var params = doc.location.search.substring(1).split('&');
135
+
136
+ for (var i = 0; i < params.length; i++) {
137
+ var p = params[i].split('=');
138
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
139
+ }
140
+
141
+ specName = paramMap.spec;
142
+ })();
143
+
144
+ return specName;
145
+ }
146
+
147
+ function createReporterDom(version) {
148
+ dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
149
+ dom.banner = self.createDom('div', { className: 'banner' },
150
+ self.createDom('span', { className: 'title' }, "Jasmine "),
151
+ self.createDom('span', { className: 'version' }, version)),
152
+
153
+ dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
154
+ dom.alert = self.createDom('div', {className: 'alert'}),
155
+ dom.results = self.createDom('div', {className: 'results'},
156
+ dom.summary = self.createDom('div', { className: 'summary' }),
157
+ dom.details = self.createDom('div', { id: 'details' }))
158
+ );
159
+ }
160
+ };
161
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporterHelpers = {};
162
+
163
+ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
164
+ var el = document.createElement(type);
165
+
166
+ for (var i = 2; i < arguments.length; i++) {
167
+ var child = arguments[i];
168
+
169
+ if (typeof child === 'string') {
170
+ el.appendChild(document.createTextNode(child));
171
+ } else {
172
+ if (child) {
173
+ el.appendChild(child);
174
+ }
175
+ }
176
+ }
177
+
178
+ for (var attr in attrs) {
179
+ if (attr == "className") {
180
+ el[attr] = attrs[attr];
181
+ } else {
182
+ el.setAttribute(attr, attrs[attr]);
183
+ }
184
+ }
185
+
186
+ return el;
187
+ };
188
+
189
+ jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
190
+ var results = child.results();
191
+ var status = results.passed() ? 'passed' : 'failed';
192
+ if (results.skipped) {
193
+ status = 'skipped';
194
+ }
195
+
196
+ return status;
197
+ };
198
+
199
+ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
200
+ var parentDiv = this.dom.summary;
201
+ var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
202
+ var parent = child[parentSuite];
203
+
204
+ if (parent) {
205
+ if (typeof this.views.suites[parent.id] == 'undefined') {
206
+ this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
207
+ }
208
+ parentDiv = this.views.suites[parent.id].element;
209
+ }
210
+
211
+ parentDiv.appendChild(childElement);
212
+ };
213
+
214
+
215
+ jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
216
+ for(var fn in jasmine.HtmlReporterHelpers) {
217
+ ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
218
+ }
219
+ };
220
+
221
+ jasmine.HtmlReporter.ReporterView = function(dom) {
222
+ this.startedAt = new Date();
223
+ this.runningSpecCount = 0;
224
+ this.completeSpecCount = 0;
225
+ this.passedCount = 0;
226
+ this.failedCount = 0;
227
+ this.skippedCount = 0;
228
+
229
+ this.createResultsMenu = function() {
230
+ this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
231
+ this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
232
+ ' | ',
233
+ this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
234
+
235
+ this.summaryMenuItem.onclick = function() {
236
+ dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
237
+ };
238
+
239
+ this.detailsMenuItem.onclick = function() {
240
+ showDetails();
241
+ };
242
+ };
243
+
244
+ this.specComplete = function(spec) {
245
+ this.completeSpecCount++;
246
+ var specView = this.views.specs[spec.id];
247
+
248
+ switch (specView.status()) {
249
+ case 'passed':
250
+ this.passedCount++;
251
+ break;
252
+
253
+ case 'failed':
254
+ this.failedCount++;
255
+ break;
256
+
257
+ case 'skipped':
258
+ this.skippedCount++;
259
+ break;
260
+ }
261
+
262
+ specView.refresh();
263
+ this.refresh();
264
+ };
265
+
266
+ this.suiteComplete = function(suite) {
267
+ var suiteView = this.views.suites[suite.id];
268
+ if (isUndefined(suiteView)) {
269
+ return;
270
+ }
271
+ suiteView.refresh();
272
+ };
273
+
274
+ this.refresh = function() {
275
+
276
+ if (isUndefined(this.resultsMenu)) {
277
+ this.createResultsMenu();
278
+ }
279
+
280
+ // currently running UI
281
+ if (isUndefined(this.runningAlert)) {
282
+ this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
283
+ dom.alert.appendChild(this.runningAlert);
284
+ }
285
+ this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + this.totalSpecCount + " spec" + (this.totalSpecCount == 1 ? "" : "s" );
286
+
287
+ // skipped specs UI
288
+ if (isUndefined(this.skippedAlert)) {
289
+ this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
290
+ }
291
+
292
+ this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + this.totalSpecCount + " spec" + (this.totalSpecCount == 1 ? "" : "s" ) + " - run all";
293
+
294
+ if (this.skippedCount === 1 && isDefined(dom.alert)) {
295
+ dom.alert.appendChild(this.skippedAlert);
296
+ }
297
+
298
+ // passing specs UI
299
+ if (isUndefined(this.passedAlert)) {
300
+ this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
301
+ }
302
+ this.passedAlert.innerHTML = "Passing " + this.passedCount + " spec" + (this.passedCount == 1 ? "" : "s" );
303
+
304
+ // failing specs UI
305
+ if (isUndefined(this.failedAlert)) {
306
+ this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
307
+ }
308
+ this.failedAlert.innerHTML = "Failing " + this.failedCount + " spec" + (this.totalSpecCount == 1 ? "" : "s" );
309
+
310
+ if (this.failedCount === 1 && isDefined(dom.alert)) {
311
+ dom.alert.appendChild(this.failedAlert);
312
+ dom.alert.appendChild(this.resultsMenu);
313
+ }
314
+
315
+ // summary info
316
+ this.summaryMenuItem.innerHTML = "" + this.runningSpecCount + " spec" + (this.runningSpecCount == 1 ? "" : "s" );
317
+ this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
318
+ };
319
+
320
+ this.complete = function() {
321
+ dom.alert.removeChild(this.runningAlert);
322
+
323
+ this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + this.totalSpecCount + " spec" + (this.totalSpecCount == 1 ? "" : "s" ) + " - run all";
324
+
325
+ if (this.failedCount === 0) {
326
+ dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + this.passedCount + " spec" + (this.passedCount == 1 ? "" : "s" )));
327
+ } else {
328
+ showDetails();
329
+ }
330
+
331
+ dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
332
+ };
333
+
334
+ this.addSpecs = function(specs, specFilter) {
335
+ this.totalSpecCount = specs.length;
336
+
337
+ this.views = {
338
+ specs: {},
339
+ suites: {}
340
+ };
341
+
342
+ for (var i = 0; i < specs.length; i++) {
343
+ var spec = specs[i];
344
+ this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
345
+ if (specFilter(spec)) {
346
+ this.runningSpecCount++;
347
+ }
348
+ }
349
+ };
350
+
351
+ return this;
352
+
353
+ function showDetails() {
354
+ if (dom.reporter.className.search(/showDetails/) === -1) {
355
+ dom.reporter.className += " showDetails";
356
+ }
357
+ }
358
+
359
+ function isUndefined(obj) {
360
+ return typeof obj === 'undefined';
361
+ }
362
+
363
+ function isDefined(obj) {
364
+ return !isUndefined(obj);
365
+ }
366
+ };
367
+
368
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
369
+
370
+
371
+ jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
372
+ this.spec = spec;
373
+ this.dom = dom;
374
+ this.views = views;
375
+
376
+ this.symbol = this.createDom('li', { className: 'pending' });
377
+ this.dom.symbolSummary.appendChild(this.symbol);
378
+
379
+ this.summary = this.createDom('div', { className: 'specSummary' },
380
+ this.createDom('a', {
381
+ className: 'description',
382
+ href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
383
+ title: this.spec.getFullName()
384
+ }, this.spec.description)
385
+ );
386
+
387
+ this.detail = this.createDom('div', { className: 'specDetail' },
388
+ this.createDom('a', {
389
+ className: 'description',
390
+ href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
391
+ title: this.spec.getFullName()
392
+ }, this.spec.getFullName())
393
+ );
394
+ };
395
+
396
+ jasmine.HtmlReporter.SpecView.prototype.status = function() {
397
+ return this.getSpecStatus(this.spec);
398
+ };
399
+
400
+ jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
401
+ this.symbol.className = this.status();
402
+
403
+ switch (this.status()) {
404
+ case 'skipped':
405
+ break;
406
+
407
+ case 'passed':
408
+ this.appendSummaryToSuiteDiv();
409
+ break;
410
+
411
+ case 'failed':
412
+ this.appendSummaryToSuiteDiv();
413
+ this.appendFailureDetail();
414
+ break;
415
+ }
416
+ };
417
+
418
+ jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
419
+ this.summary.className += ' ' + this.status();
420
+ this.appendToSummary(this.spec, this.summary);
421
+ };
422
+
423
+ jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
424
+ this.detail.className += ' ' + this.status();
425
+
426
+ var resultItems = this.spec.results().getItems();
427
+ var messagesDiv = this.createDom('div', { className: 'messages' });
428
+
429
+ for (var i = 0; i < resultItems.length; i++) {
430
+ var result = resultItems[i];
431
+
432
+ if (result.type == 'log') {
433
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
434
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
435
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
436
+
437
+ if (result.trace.stack) {
438
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
439
+ }
440
+ }
441
+ }
442
+
443
+ if (messagesDiv.childNodes.length > 0) {
444
+ this.detail.appendChild(messagesDiv);
445
+ this.dom.details.appendChild(this.detail);
446
+ }
447
+ };
448
+
449
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
450
+ this.suite = suite;
451
+ this.dom = dom;
452
+ this.views = views;
453
+
454
+ this.element = this.createDom('div', { className: 'suite' },
455
+ this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
456
+ );
457
+
458
+ this.appendToSummary(this.suite, this.element);
459
+ };
460
+
461
+ jasmine.HtmlReporter.SuiteView.prototype.status = function() {
462
+ return this.getSpecStatus(this.suite);
463
+ };
464
+
465
+ jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
466
+ this.element.className += " " + this.status();
467
+ };
468
+
469
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
470
+
1
471
  jasmine.TrivialReporter = function(doc) {
2
472
  this.document = doc || document;
3
473
  this.suiteDivs = {};
4
474
  this.logRunningSpecs = false;
475
+ this.log("DEPRECATION WARNING: jasmine.TrivialReporter is deprecated as of v1.2 and will be removed in version 2.0. Please use (the vastly nicer) jasmine.HtmlReporter.")
5
476
  };
6
477
 
7
478
  jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
@@ -31,7 +502,7 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
31
502
  jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
32
503
  var showPassed, showSkipped;
33
504
 
34
- this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
505
+ this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
35
506
  this.createDom('div', { className: 'banner' },
36
507
  this.createDom('div', { className: 'logo' },
37
508
  this.createDom('span', { className: 'title' }, "Jasmine"),
@@ -1,137 +1,386 @@
1
+ /* line 25, _HTMLReporter.scss */
1
2
  body {
2
- font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
3
+ background-color: #eeeeee;
4
+ padding: 0;
5
+ margin: 5px;
6
+ overflow-y: scroll;
3
7
  }
4
8
 
5
-
6
- .jasmine_reporter a:visited, .jasmine_reporter a {
7
- color: #303;
9
+ /* line 32, _HTMLReporter.scss */
10
+ #HTMLReporter {
11
+ font-size: 11px;
12
+ font-family: Monaco, "Lucida Console", monospace;
13
+ line-height: 14px;
14
+ color: #333333;
8
15
  }
9
-
10
- .jasmine_reporter a:hover, .jasmine_reporter a:active {
11
- color: blue;
16
+ /* line 39, _HTMLReporter.scss */
17
+ #HTMLReporter a {
18
+ text-decoration: none;
19
+ }
20
+ /* line 42, _HTMLReporter.scss */
21
+ #HTMLReporter a:hover {
22
+ text-decoration: underline;
23
+ }
24
+ /* line 47, _HTMLReporter.scss */
25
+ #HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 {
26
+ margin: 0;
27
+ line-height: 14px;
28
+ }
29
+ /* line 58, _HTMLReporter.scss */
30
+ #HTMLReporter .banner,
31
+ #HTMLReporter .symbolSummary,
32
+ #HTMLReporter .summary,
33
+ #HTMLReporter .resultMessage,
34
+ #HTMLReporter .specDetail .description,
35
+ #HTMLReporter .alert .bar,
36
+ #HTMLReporter .stackTrace {
37
+ padding-left: 9px;
38
+ padding-right: 9px;
39
+ }
40
+ /* line 65, _HTMLReporter.scss */
41
+ #HTMLReporter #jasmine_content {
42
+ position: fixed;
43
+ right: 100%;
44
+ }
45
+ /* line 70, _HTMLReporter.scss */
46
+ #HTMLReporter .version {
47
+ color: #aaaaaa;
48
+ }
49
+ /* line 77, _HTMLReporter.scss */
50
+ #HTMLReporter .banner {
51
+ margin-top: 14px;
52
+ }
53
+ /* line 81, _HTMLReporter.scss */
54
+ #HTMLReporter .duration {
55
+ color: #aaaaaa;
56
+ float: right;
57
+ }
58
+ /* line 90, _HTMLReporter.scss */
59
+ #HTMLReporter .symbolSummary {
60
+ overflow: hidden;
61
+ *zoom: 1;
62
+ margin: 14px 0;
63
+ }
64
+ /* line 94, _HTMLReporter.scss */
65
+ #HTMLReporter .symbolSummary li {
66
+ display: block;
67
+ float: left;
68
+ height: 7px;
69
+ width: 14px;
70
+ margin-bottom: 7px;
71
+ font-size: 16px;
72
+ }
73
+ /* line 105, _HTMLReporter.scss */
74
+ #HTMLReporter .symbolSummary li.passed {
75
+ font-size: 14px;
76
+ }
77
+ /* line 108, _HTMLReporter.scss */
78
+ #HTMLReporter .symbolSummary li.passed:before {
79
+ color: #5e7d00;
80
+ content: "\02022";
81
+ }
82
+ /* line 114, _HTMLReporter.scss */
83
+ #HTMLReporter .symbolSummary li.failed {
84
+ line-height: 9px;
85
+ }
86
+ /* line 117, _HTMLReporter.scss */
87
+ #HTMLReporter .symbolSummary li.failed:before {
88
+ color: #b03911;
89
+ content: "x";
90
+ font-weight: bold;
91
+ margin-left: -1px;
92
+ }
93
+ /* line 125, _HTMLReporter.scss */
94
+ #HTMLReporter .symbolSummary li.skipped {
95
+ font-size: 14px;
96
+ }
97
+ /* line 128, _HTMLReporter.scss */
98
+ #HTMLReporter .symbolSummary li.skipped:before {
99
+ color: #bababa;
100
+ content: "\02022";
101
+ }
102
+ /* line 134, _HTMLReporter.scss */
103
+ #HTMLReporter .symbolSummary li.pending {
104
+ line-height: 11px;
105
+ }
106
+ /* line 137, _HTMLReporter.scss */
107
+ #HTMLReporter .symbolSummary li.pending:before {
108
+ color: #aaaaaa;
109
+ content: "-";
110
+ }
111
+ /* line 149, _HTMLReporter.scss */
112
+ #HTMLReporter .bar {
113
+ line-height: 28px;
114
+ font-size: 14px;
115
+ display: block;
116
+ color: #eee;
117
+ }
118
+ /* line 158, _HTMLReporter.scss */
119
+ #HTMLReporter .runningAlert {
120
+ background-color: #666666;
121
+ }
122
+ /* line 162, _HTMLReporter.scss */
123
+ #HTMLReporter .skippedAlert {
124
+ background-color: #aaaaaa;
125
+ }
126
+ /* line 165, _HTMLReporter.scss */
127
+ #HTMLReporter .skippedAlert:first-child {
128
+ background-color: #333333;
129
+ }
130
+ /* line 169, _HTMLReporter.scss */
131
+ #HTMLReporter .skippedAlert:hover {
132
+ text-decoration: none;
133
+ color: white;
134
+ text-decoration: underline;
135
+ }
136
+ /* line 176, _HTMLReporter.scss */
137
+ #HTMLReporter .passingAlert {
138
+ background-color: #a6b779;
139
+ }
140
+ /* line 179, _HTMLReporter.scss */
141
+ #HTMLReporter .passingAlert:first-child {
142
+ background-color: #5e7d00;
143
+ }
144
+ /* line 184, _HTMLReporter.scss */
145
+ #HTMLReporter .failingAlert {
146
+ background-color: #cf867e;
147
+ }
148
+ /* line 187, _HTMLReporter.scss */
149
+ #HTMLReporter .failingAlert:first-child {
150
+ background-color: #b03911;
151
+ }
152
+ /* line 200, _HTMLReporter.scss */
153
+ #HTMLReporter .results {
154
+ margin-top: 14px;
155
+ }
156
+ /* line 208, _HTMLReporter.scss */
157
+ #HTMLReporter #details {
158
+ display: none;
159
+ }
160
+ /* line 213, _HTMLReporter.scss */
161
+ #HTMLReporter .resultsMenu,
162
+ #HTMLReporter .resultsMenu a {
163
+ background-color: #fff;
164
+ color: #333333;
165
+ }
166
+ /* line 220, _HTMLReporter.scss */
167
+ #HTMLReporter.showDetails .summaryMenuItem {
168
+ font-weight: normal;
169
+ text-decoration: inherit;
170
+ }
171
+ /* line 224, _HTMLReporter.scss */
172
+ #HTMLReporter.showDetails .summaryMenuItem:hover {
173
+ text-decoration: underline;
174
+ }
175
+ /* line 229, _HTMLReporter.scss */
176
+ #HTMLReporter.showDetails .detailsMenuItem {
177
+ font-weight: bold;
178
+ text-decoration: underline;
179
+ }
180
+ /* line 234, _HTMLReporter.scss */
181
+ #HTMLReporter.showDetails .summary {
182
+ display: none;
183
+ }
184
+ /* line 238, _HTMLReporter.scss */
185
+ #HTMLReporter.showDetails #details {
186
+ display: block;
187
+ }
188
+ /* line 243, _HTMLReporter.scss */
189
+ #HTMLReporter .summaryMenuItem {
190
+ font-weight: bold;
191
+ text-decoration: underline;
192
+ }
193
+ /* line 253, _HTMLReporter.scss */
194
+ #HTMLReporter .summary {
195
+ margin-top: 14px;
196
+ }
197
+ /* line 256, _HTMLReporter.scss */
198
+ #HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary {
199
+ margin-left: 14px;
200
+ }
201
+ /* line 261, _HTMLReporter.scss */
202
+ #HTMLReporter .summary .specSummary.passed a {
203
+ color: #5e7d00;
204
+ }
205
+ /* line 264, _HTMLReporter.scss */
206
+ #HTMLReporter .summary .specSummary.failed a {
207
+ color: #b03911;
208
+ }
209
+ /* line 270, _HTMLReporter.scss */
210
+ #HTMLReporter .description + .suite {
211
+ margin-top: 0;
212
+ }
213
+ /* line 274, _HTMLReporter.scss */
214
+ #HTMLReporter .suite {
215
+ margin-top: 14px;
216
+ }
217
+ /* line 277, _HTMLReporter.scss */
218
+ #HTMLReporter .suite a {
219
+ color: #333333;
220
+ }
221
+ /* line 288, _HTMLReporter.scss */
222
+ #HTMLReporter #details .specDetail {
223
+ margin-bottom: 28px;
224
+ }
225
+ /* line 291, _HTMLReporter.scss */
226
+ #HTMLReporter #details .specDetail .description {
227
+ display: block;
228
+ color: white;
229
+ background-color: #b03911;
230
+ }
231
+ /* line 303, _HTMLReporter.scss */
232
+ #HTMLReporter .resultMessage {
233
+ padding-top: 14px;
234
+ color: #333333;
235
+ }
236
+ /* line 309, _HTMLReporter.scss */
237
+ #HTMLReporter .resultMessage span.result {
238
+ display: block;
239
+ }
240
+ /* line 313, _HTMLReporter.scss */
241
+ #HTMLReporter .stackTrace {
242
+ margin: 5px 0 0 0;
243
+ max-height: 224px;
244
+ overflow: auto;
245
+ line-height: 18px;
246
+ color: #666666;
247
+ border: 1px solid #ddd;
248
+ background: white;
249
+ white-space: pre;
12
250
  }
13
251
 
14
- .run_spec {
15
- float:right;
252
+ /* line 2, _TrivialReporter.scss */
253
+ #TrivialReporter {
254
+ padding: 8px 13px;
255
+ position: absolute;
256
+ top: 0;
257
+ bottom: 0;
258
+ left: 0;
259
+ right: 0;
260
+ overflow-y: scroll;
261
+ background-color: white;
262
+ font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
263
+ /*.resultMessage {*/
264
+ /*white-space: pre;*/
265
+ /*}*/
266
+ }
267
+ /* line 14, _TrivialReporter.scss */
268
+ #TrivialReporter a:visited, #TrivialReporter a {
269
+ color: #303;
270
+ }
271
+ /* line 18, _TrivialReporter.scss */
272
+ #TrivialReporter a:hover, #TrivialReporter a:active {
273
+ color: blue;
274
+ }
275
+ /* line 22, _TrivialReporter.scss */
276
+ #TrivialReporter .run_spec {
277
+ float: right;
16
278
  padding-right: 5px;
17
279
  font-size: .8em;
18
280
  text-decoration: none;
19
281
  }
20
-
21
- .jasmine_reporter {
22
- margin: 0 5px;
23
- }
24
-
25
- .banner {
282
+ /* line 29, _TrivialReporter.scss */
283
+ #TrivialReporter .banner {
26
284
  color: #303;
27
285
  background-color: #fef;
28
286
  padding: 5px;
29
287
  }
30
-
31
- .logo {
288
+ /* line 35, _TrivialReporter.scss */
289
+ #TrivialReporter .logo {
32
290
  float: left;
33
291
  font-size: 1.1em;
34
292
  padding-left: 5px;
35
293
  }
36
-
37
- .logo .version {
294
+ /* line 41, _TrivialReporter.scss */
295
+ #TrivialReporter .logo .version {
38
296
  font-size: .6em;
39
297
  padding-left: 1em;
40
298
  }
41
-
42
- .runner.running {
299
+ /* line 46, _TrivialReporter.scss */
300
+ #TrivialReporter .runner.running {
43
301
  background-color: yellow;
44
302
  }
45
-
46
-
47
- .options {
303
+ /* line 51, _TrivialReporter.scss */
304
+ #TrivialReporter .options {
48
305
  text-align: right;
49
306
  font-size: .8em;
50
307
  }
51
-
52
-
53
-
54
-
55
- .suite {
308
+ /* line 59, _TrivialReporter.scss */
309
+ #TrivialReporter .suite {
56
310
  border: 1px outset gray;
57
311
  margin: 5px 0;
58
312
  padding-left: 1em;
59
313
  }
60
-
61
- .suite .suite {
62
- margin: 5px;
314
+ /* line 65, _TrivialReporter.scss */
315
+ #TrivialReporter .suite .suite {
316
+ margin: 5px;
63
317
  }
64
-
65
- .suite.passed {
318
+ /* line 69, _TrivialReporter.scss */
319
+ #TrivialReporter .suite.passed {
66
320
  background-color: #dfd;
67
321
  }
68
-
69
- .suite.failed {
322
+ /* line 73, _TrivialReporter.scss */
323
+ #TrivialReporter .suite.failed {
70
324
  background-color: #fdd;
71
325
  }
72
-
73
- .spec {
326
+ /* line 77, _TrivialReporter.scss */
327
+ #TrivialReporter .spec {
74
328
  margin: 5px;
75
329
  padding-left: 1em;
76
330
  clear: both;
77
331
  }
78
-
79
- .spec.failed, .spec.passed, .spec.skipped {
332
+ /* line 83, _TrivialReporter.scss */
333
+ #TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped {
80
334
  padding-bottom: 5px;
81
335
  border: 1px solid gray;
82
336
  }
83
-
84
- .spec.failed {
337
+ /* line 88, _TrivialReporter.scss */
338
+ #TrivialReporter .spec.failed {
85
339
  background-color: #fbb;
86
340
  border-color: red;
87
341
  }
88
-
89
- .spec.passed {
342
+ /* line 93, _TrivialReporter.scss */
343
+ #TrivialReporter .spec.passed {
90
344
  background-color: #bfb;
91
345
  border-color: green;
92
346
  }
93
-
94
- .spec.skipped {
347
+ /* line 98, _TrivialReporter.scss */
348
+ #TrivialReporter .spec.skipped {
95
349
  background-color: #bbb;
96
350
  }
97
-
98
- .messages {
351
+ /* line 102, _TrivialReporter.scss */
352
+ #TrivialReporter .messages {
99
353
  border-left: 1px dashed gray;
100
354
  padding-left: 1em;
101
355
  padding-right: 1em;
102
356
  }
103
-
104
- .passed {
357
+ /* line 108, _TrivialReporter.scss */
358
+ #TrivialReporter .passed {
105
359
  background-color: #cfc;
106
360
  display: none;
107
361
  }
108
-
109
- .failed {
362
+ /* line 113, _TrivialReporter.scss */
363
+ #TrivialReporter .failed {
110
364
  background-color: #fbb;
111
365
  }
112
-
113
- .skipped {
366
+ /* line 117, _TrivialReporter.scss */
367
+ #TrivialReporter .skipped {
114
368
  color: #777;
115
369
  background-color: #eee;
116
370
  display: none;
117
371
  }
118
-
119
-
120
- /*.resultMessage {*/
121
- /*white-space: pre;*/
122
- /*}*/
123
-
124
- .resultMessage span.result {
372
+ /* line 128, _TrivialReporter.scss */
373
+ #TrivialReporter .resultMessage span.result {
125
374
  display: block;
126
375
  line-height: 2em;
127
376
  color: black;
128
377
  }
129
-
130
- .resultMessage .mismatch {
378
+ /* line 134, _TrivialReporter.scss */
379
+ #TrivialReporter .resultMessage .mismatch {
131
380
  color: black;
132
381
  }
133
-
134
- .stackTrace {
382
+ /* line 138, _TrivialReporter.scss */
383
+ #TrivialReporter .stackTrace {
135
384
  white-space: pre;
136
385
  font-size: .8em;
137
386
  margin-left: 10px;
@@ -141,24 +390,22 @@ body {
141
390
  padding: 1em;
142
391
  background: #eef;
143
392
  }
144
-
145
- .finished-at {
393
+ /* line 149, _TrivialReporter.scss */
394
+ #TrivialReporter .finished-at {
146
395
  padding-left: 1em;
147
396
  font-size: .6em;
148
397
  }
149
-
150
- .show-passed .passed,
151
- .show-skipped .skipped {
398
+ /* line 155, _TrivialReporter.scss */
399
+ #TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped {
152
400
  display: block;
153
401
  }
154
-
155
-
156
- #jasmine_content {
157
- position:fixed;
402
+ /* line 160, _TrivialReporter.scss */
403
+ #TrivialReporter #jasmine_content {
404
+ position: fixed;
158
405
  right: 100%;
159
406
  }
160
-
161
- .runner {
407
+ /* line 165, _TrivialReporter.scss */
408
+ #TrivialReporter .runner {
162
409
  border: 1px solid gray;
163
410
  display: block;
164
411
  margin: 5px 0;
@@ -2470,7 +2470,8 @@ jasmine.getGlobal().clearInterval = function(timeoutKey) {
2470
2470
 
2471
2471
  jasmine.version_= {
2472
2472
  "major": 1,
2473
- "minor": 1,
2473
+ "minor": 2,
2474
2474
  "build": 0,
2475
- "revision": 1315677058
2475
+ "revision": 1315672648,
2476
+ "release_candidate": 1
2476
2477
  };
@@ -0,0 +1,194 @@
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('Matcher reporting', function () {
48
+ var getResultMessageDiv = function (body) {
49
+ var divs = body.getElementsByTagName("div");
50
+ for (var i = 0; i < divs.length; i++) {
51
+ if (divs[i].className.match(/resultMessage/)) {
52
+ return divs[i];
53
+ }
54
+ }
55
+ };
56
+
57
+ var runner, spec, fakeTimer;
58
+ beforeEach(function () {
59
+ fakeTimer = new jasmine.FakeTimer();
60
+ env.setTimeout = fakeTimer.setTimeout;
61
+ env.clearTimeout = fakeTimer.clearTimeout;
62
+ env.setInterval = fakeTimer.setInterval;
63
+ env.clearInterval = fakeTimer.clearInterval;
64
+ runner = env.currentRunner();
65
+ var suite = new jasmine.Suite(env, 'some suite');
66
+ runner.add(suite);
67
+ spec = new jasmine.Spec(env, suite, 'some spec');
68
+ suite.add(spec);
69
+ fakeDocument.location.search = "?";
70
+ env.addReporter(htmlReporter);
71
+ });
72
+
73
+ describe('toContain', function () {
74
+ it('should show actual and expected', function () {
75
+ spec.runs(function () {
76
+ this.expect('foo').toContain('bar');
77
+ });
78
+ runner.execute();
79
+ fakeTimer.tick(0);
80
+
81
+ var resultEl = getResultMessageDiv(body);
82
+ expect(resultEl.innerHTML).toMatch(/foo/);
83
+ expect(resultEl.innerHTML).toMatch(/bar/);
84
+ });
85
+ });
86
+ });
87
+
88
+ describe("failure messages (integration)", function () {
89
+ var spec, results, expectationResult;
90
+
91
+ it("should add the failure message to the DOM (non-toEquals matchers)", function() {
92
+ env.describe("suite", function() {
93
+ env.it("will have log messages", function() {
94
+ this.expect('a').toBeNull();
95
+ });
96
+ });
97
+
98
+ env.addReporter(htmlReporter);
99
+ env.execute();
100
+
101
+ var divs = body.getElementsByTagName("div");
102
+ var errorDiv = findElement(divs, 'resultMessage fail');
103
+ expect(errorDiv.innerHTML).toMatch(/Expected 'a' to be null/);
104
+ });
105
+
106
+ it("should add the failure message to the DOM (non-toEquals matchers) html escaping", function() {
107
+ env.describe("suite", function() {
108
+ env.it("will have log messages", function() {
109
+ this.expect('1 < 2').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 '1 &lt; 2' to be null/);
119
+ });
120
+ });
121
+
122
+ describe("log messages", function() {
123
+ it("should appear in the report of a failed spec", function() {
124
+ env.describe("suite", function() {
125
+ env.it("will have log messages", function() {
126
+ this.log("this is a", "multipart log message");
127
+ this.expect(true).toBeFalsy();
128
+ });
129
+ });
130
+
131
+ env.addReporter(htmlReporter);
132
+ env.execute();
133
+
134
+ var divs = body.getElementsByTagName("div");
135
+ var errorDiv = findElement(divs, 'specDetail failed');
136
+ expect(errorDiv.innerHTML).toMatch("this is a multipart log message");
137
+ });
138
+
139
+ xit("should work on IE without console.log.apply", function() {
140
+ });
141
+ });
142
+
143
+ describe("duplicate example names", function() {
144
+ it("should report failures correctly", function() {
145
+ var suite1 = env.describe("suite", function() {
146
+ env.it("will have log messages", function() {
147
+ this.log("this one fails!");
148
+ this.expect(true).toBeFalsy();
149
+ });
150
+ });
151
+
152
+ var suite2 = env.describe("suite", function() {
153
+ env.it("will have log messages", function() {
154
+ this.log("this one passes!");
155
+ this.expect(true).toBeTruthy();
156
+ });
157
+ });
158
+
159
+ env.addReporter(htmlReporter);
160
+ env.execute();
161
+
162
+ var divs = body.getElementsByTagName("div");
163
+ var failedSpecDiv = findElement(divs, 'specDetail failed');
164
+ expect(failedSpecDiv.className).toEqual('specDetail failed');
165
+ expect(failedSpecDiv.innerHTML).toContain("this one fails!");
166
+ expect(failedSpecDiv.innerHTML).not.toContain("this one passes!");
167
+ });
168
+ });
169
+
170
+ describe('#reportSpecStarting', function() {
171
+ beforeEach(function () {
172
+ env.describe("suite 1", function() {
173
+ env.it("spec 1", function() {
174
+ });
175
+ });
176
+ spyOn(htmlReporter, 'log').andCallThrough();
177
+ });
178
+
179
+ it('DOES NOT log running specs by default', function() {
180
+ env.addReporter(htmlReporter);
181
+ env.execute();
182
+
183
+ expect(htmlReporter.log).not.toHaveBeenCalled();
184
+ });
185
+
186
+ it('logs running specs when log_running_specs is true', function() {
187
+ htmlReporter.logRunningSpecs = true;
188
+ env.addReporter(htmlReporter);
189
+ env.execute();
190
+
191
+ expect(htmlReporter.log).toHaveBeenCalledWith('>> Jasmine Running suite 1 spec 1...');
192
+ });
193
+ });
194
+ });
@@ -1,6 +1,6 @@
1
1
  module Jasmine
2
2
  module Core
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0.rc1"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.1.0
4
+ prerelease: 6
5
+ version: 1.2.0.rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rajan Agaskar
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-09-10 00:00:00 -04:00
15
+ date: 2011-09-14 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,7 @@ files:
99
99
  - ./lib/jasmine-core/spec/core/SuiteSpec.js
100
100
  - ./lib/jasmine-core/spec/core/UtilSpec.js
101
101
  - ./lib/jasmine-core/spec/core/WaitsForBlockSpec.js
102
+ - ./lib/jasmine-core/spec/html/HTMLReporterSpec.js
102
103
  - ./lib/jasmine-core/spec/html/MatchersHtmlSpec.js
103
104
  - ./lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js
104
105
  - ./lib/jasmine-core/spec/html/TrivialReporterSpec.js
@@ -121,9 +122,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
122
  required_rubygems_version: !ruby/object:Gem::Requirement
122
123
  none: false
123
124
  requirements:
124
- - - ">="
125
+ - - ">"
125
126
  - !ruby/object:Gem::Version
126
- version: "0"
127
+ version: 1.3.1
127
128
  requirements: []
128
129
 
129
130
  rubyforge_project: jasmine-core