teaspoon-jasmine 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/lib/teaspoon-jasmine.rb +4 -0
  3. data/lib/teaspoon/jasmine/assets/jasmine/1.3.1.js +2602 -0
  4. data/lib/teaspoon/jasmine/assets/jasmine/2.0.3.js +2593 -0
  5. data/lib/teaspoon/jasmine/assets/jasmine/2.1.3.js +2908 -0
  6. data/lib/teaspoon/jasmine/assets/jasmine/2.2.0.js +3048 -0
  7. data/lib/teaspoon/jasmine/assets/jasmine/MIT.LICENSE +20 -0
  8. data/lib/teaspoon/jasmine/assets/support/jasmine-jquery-1.7.0.js +720 -0
  9. data/lib/teaspoon/jasmine/assets/support/jasmine-jquery-2.0.0.js +812 -0
  10. data/lib/teaspoon/jasmine/assets/support/jasmine-jquery-2.1.0.js +832 -0
  11. data/lib/teaspoon/jasmine/assets/teaspoon-jasmine1.js +1447 -0
  12. data/lib/teaspoon/jasmine/assets/teaspoon-jasmine2.js +1490 -0
  13. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1.coffee +10 -0
  14. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/fixture.coffee +29 -0
  15. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/initialize.coffee +1 -0
  16. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/reporters/html.coffee +13 -0
  17. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/responder.coffee +23 -0
  18. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/runner.coffee +32 -0
  19. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/spec.coffee +37 -0
  20. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine1/suite.coffee +8 -0
  21. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2.coffee +10 -0
  22. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/fixture.coffee +19 -0
  23. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/initialize.coffee +23 -0
  24. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/reporters/console.coffee +18 -0
  25. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/reporters/html.coffee +11 -0
  26. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/responder.coffee +39 -0
  27. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/runner.coffee +26 -0
  28. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/spec.coffee +36 -0
  29. data/lib/teaspoon/jasmine/assets/teaspoon/jasmine2/suite.coffee +8 -0
  30. data/lib/teaspoon/jasmine/framework.rb +35 -0
  31. data/lib/teaspoon/jasmine/templates/spec_helper.coffee +32 -0
  32. data/lib/teaspoon/jasmine/templates/spec_helper.js +32 -0
  33. data/lib/teaspoon/jasmine/version.rb +5 -0
  34. metadata +92 -0
@@ -0,0 +1,1490 @@
1
+ (function() {
2
+ this.Teaspoon = (function() {
3
+ function Teaspoon() {}
4
+
5
+ Teaspoon.defer = false;
6
+
7
+ Teaspoon.slow = 75;
8
+
9
+ Teaspoon.root = window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "");
10
+
11
+ Teaspoon.started = false;
12
+
13
+ Teaspoon.finished = false;
14
+
15
+ Teaspoon.Reporters = {};
16
+
17
+ Teaspoon.Date = Date;
18
+
19
+ Teaspoon.location = window.location;
20
+
21
+ Teaspoon.messages = [];
22
+
23
+ Teaspoon.execute = function() {
24
+ if (!Teaspoon.framework) {
25
+ throw "No framework registered. Expected a framework to register itself, but nothing has.";
26
+ }
27
+ if (Teaspoon.defer) {
28
+ Teaspoon.defer = false;
29
+ return;
30
+ }
31
+ if (Teaspoon.started) {
32
+ Teaspoon.reload();
33
+ }
34
+ Teaspoon.started = true;
35
+ return new (Teaspoon.resolveClass("Runner"))();
36
+ };
37
+
38
+ Teaspoon.reload = function() {
39
+ return window.location.reload();
40
+ };
41
+
42
+ Teaspoon.onWindowLoad = function(method) {
43
+ var originalOnload;
44
+ originalOnload = window.onload;
45
+ return window.onload = function() {
46
+ if (originalOnload && originalOnload.call) {
47
+ originalOnload();
48
+ }
49
+ return method();
50
+ };
51
+ };
52
+
53
+ Teaspoon.resolveDependenciesFromParams = function(all) {
54
+ var dep, deps, file, j, k, len, len1, parts, path, paths;
55
+ if (all == null) {
56
+ all = [];
57
+ }
58
+ deps = [];
59
+ if ((paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) === null) {
60
+ return all;
61
+ }
62
+ for (j = 0, len = paths.length; j < len; j++) {
63
+ path = paths[j];
64
+ parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i);
65
+ if (parts === null) {
66
+ continue;
67
+ }
68
+ file = parts[1].substr(parts[1].lastIndexOf("/") + 1);
69
+ for (k = 0, len1 = all.length; k < len1; k++) {
70
+ dep = all[k];
71
+ if (dep.indexOf(file) >= 0) {
72
+ deps.push(dep);
73
+ }
74
+ }
75
+ }
76
+ return deps;
77
+ };
78
+
79
+ Teaspoon.log = function() {
80
+ var e;
81
+ Teaspoon.messages.push(arguments[0]);
82
+ try {
83
+ return console.log.apply(console, arguments);
84
+ } catch (_error) {
85
+ e = _error;
86
+ throw new Error("Unable to use console.log for logging");
87
+ }
88
+ };
89
+
90
+ Teaspoon.getMessages = function() {
91
+ var messages;
92
+ messages = Teaspoon.messages;
93
+ Teaspoon.messages = [];
94
+ return messages;
95
+ };
96
+
97
+ Teaspoon.setFramework = function(namespace) {
98
+ Teaspoon.framework = namespace;
99
+ return window.fixture = Teaspoon.resolveClass("Fixture");
100
+ };
101
+
102
+ Teaspoon.resolveClass = function(klass) {
103
+ var framework_override, teaspoon_core;
104
+ if (framework_override = Teaspoon.checkNamespace(Teaspoon.framework, klass)) {
105
+ return framework_override;
106
+ } else if (teaspoon_core = Teaspoon.checkNamespace(Teaspoon, klass)) {
107
+ return teaspoon_core;
108
+ }
109
+ throw "Could not find the class you're looking for: " + klass;
110
+ };
111
+
112
+ Teaspoon.checkNamespace = function(root, klass) {
113
+ var i, j, len, namespace, namespaces, scope;
114
+ namespaces = klass.split('.');
115
+ scope = root;
116
+ for (i = j = 0, len = namespaces.length; j < len; i = ++j) {
117
+ namespace = namespaces[i];
118
+ if (!(scope = scope[namespace])) {
119
+ return false;
120
+ }
121
+ }
122
+ return scope;
123
+ };
124
+
125
+ return Teaspoon;
126
+
127
+ })();
128
+
129
+ }).call(this);
130
+ (function() {
131
+ Teaspoon.Runner = (function() {
132
+ Runner.run = false;
133
+
134
+ function Runner() {
135
+ if (this.constructor.run) {
136
+ return;
137
+ }
138
+ this.constructor.run = true;
139
+ this.fixturePath = Teaspoon.root + "/fixtures";
140
+ this.params = Teaspoon.params = this.getParams();
141
+ this.setup();
142
+ }
143
+
144
+ Runner.prototype.getParams = function() {
145
+ var i, len, name, param, params, ref, ref1, value;
146
+ params = {};
147
+ ref = Teaspoon.location.search.substring(1).split("&");
148
+ for (i = 0, len = ref.length; i < len; i++) {
149
+ param = ref[i];
150
+ ref1 = param.split("="), name = ref1[0], value = ref1[1];
151
+ params[decodeURIComponent(name)] = decodeURIComponent(value);
152
+ }
153
+ return params;
154
+ };
155
+
156
+ Runner.prototype.getReporter = function() {
157
+ if (this.params["reporter"]) {
158
+ return this.findReporter(this.params["reporter"]);
159
+ } else {
160
+ if (window.navigator.userAgent.match(/PhantomJS/)) {
161
+ return this.findReporter("Console");
162
+ } else {
163
+ return this.findReporter("HTML");
164
+ }
165
+ }
166
+ };
167
+
168
+ Runner.prototype.setup = function() {};
169
+
170
+ Runner.prototype.findReporter = function(type) {
171
+ return Teaspoon.resolveClass("Reporters." + type);
172
+ };
173
+
174
+ return Runner;
175
+
176
+ })();
177
+
178
+ }).call(this);
179
+ (function() {
180
+ var slice = [].slice;
181
+
182
+ Teaspoon.Fixture = (function() {
183
+ var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
184
+
185
+ Fixture.cache = {};
186
+
187
+ Fixture.el = null;
188
+
189
+ Fixture.$el = null;
190
+
191
+ Fixture.json = [];
192
+
193
+ Fixture.preload = function() {
194
+ var i, len, results, url, urls;
195
+ urls = 1 <= arguments.length ? slice.call(arguments, 0) : [];
196
+ results = [];
197
+ for (i = 0, len = urls.length; i < len; i++) {
198
+ url = urls[i];
199
+ results.push(preload(url));
200
+ }
201
+ return results;
202
+ };
203
+
204
+ Fixture.load = function() {
205
+ var append, i, index, j, len, results, url, urls;
206
+ urls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
207
+ if (append == null) {
208
+ append = false;
209
+ }
210
+ if (typeof append !== "boolean") {
211
+ urls.push(append);
212
+ append = false;
213
+ }
214
+ results = [];
215
+ for (index = j = 0, len = urls.length; j < len; index = ++j) {
216
+ url = urls[index];
217
+ results.push(load(url, append || index > 0));
218
+ }
219
+ return results;
220
+ };
221
+
222
+ Fixture.set = function() {
223
+ var append, html, htmls, i, index, j, len, results;
224
+ htmls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
225
+ if (append == null) {
226
+ append = false;
227
+ }
228
+ if (typeof append !== "boolean") {
229
+ htmls.push(append);
230
+ append = false;
231
+ }
232
+ results = [];
233
+ for (index = j = 0, len = htmls.length; j < len; index = ++j) {
234
+ html = htmls[index];
235
+ results.push(set(html, append || index > 0));
236
+ }
237
+ return results;
238
+ };
239
+
240
+ Fixture.cleanup = function() {
241
+ return cleanup();
242
+ };
243
+
244
+ function Fixture() {
245
+ window.fixture.load.apply(window, arguments);
246
+ }
247
+
248
+ xhr = null;
249
+
250
+ preload = function(url) {
251
+ return load(url, false, true);
252
+ };
253
+
254
+ load = function(url, append, preload) {
255
+ var cached, value;
256
+ if (preload == null) {
257
+ preload = false;
258
+ }
259
+ if (cached = window.fixture.cache[url]) {
260
+ return loadComplete(url, cached.type, cached.content, append, preload);
261
+ }
262
+ value = null;
263
+ xhrRequest(url, function() {
264
+ if (xhr.readyState !== 4) {
265
+ return;
266
+ }
267
+ if (xhr.status !== 200) {
268
+ throw "Unable to load fixture \"" + url + "\".";
269
+ }
270
+ return value = loadComplete(url, xhr.getResponseHeader("content-type"), xhr.responseText, append, preload);
271
+ });
272
+ return value;
273
+ };
274
+
275
+ loadComplete = function(url, type, content, append, preload) {
276
+ window.fixture.cache[url] = {
277
+ type: type,
278
+ content: content
279
+ };
280
+ if (type.match(/application\/json;/)) {
281
+ return Fixture.json[Fixture.json.push(JSON.parse(content)) - 1];
282
+ }
283
+ if (preload) {
284
+ return content;
285
+ }
286
+ if (append) {
287
+ addContent(content);
288
+ } else {
289
+ putContent(content);
290
+ }
291
+ return window.fixture.el;
292
+ };
293
+
294
+ set = function(content, append) {
295
+ if (append) {
296
+ return addContent(content);
297
+ } else {
298
+ return putContent(content);
299
+ }
300
+ };
301
+
302
+ putContent = function(content) {
303
+ cleanup();
304
+ create();
305
+ return window.fixture.el.innerHTML = content;
306
+ };
307
+
308
+ addContent = function(content) {
309
+ if (!window.fixture.el) {
310
+ create();
311
+ }
312
+ return window.fixture.el.innerHTML += content;
313
+ };
314
+
315
+ create = function() {
316
+ var ref;
317
+ window.fixture.el = document.createElement("div");
318
+ if (typeof window.$ === 'function') {
319
+ window.fixture.$el = $(window.fixture.el);
320
+ }
321
+ window.fixture.el.id = "teaspoon-fixtures";
322
+ return (ref = document.body) != null ? ref.appendChild(window.fixture.el) : void 0;
323
+ };
324
+
325
+ cleanup = function() {
326
+ var base, ref, ref1;
327
+ (base = window.fixture).el || (base.el = document.getElementById("teaspoon-fixtures"));
328
+ if ((ref = window.fixture.el) != null) {
329
+ if ((ref1 = ref.parentNode) != null) {
330
+ ref1.removeChild(window.fixture.el);
331
+ }
332
+ }
333
+ return window.fixture.el = null;
334
+ };
335
+
336
+ xhrRequest = function(url, callback) {
337
+ var e;
338
+ if (window.XMLHttpRequest) {
339
+ xhr = new XMLHttpRequest();
340
+ } else if (window.ActiveXObject) {
341
+ try {
342
+ xhr = new ActiveXObject("Msxml2.XMLHTTP");
343
+ } catch (_error) {
344
+ e = _error;
345
+ try {
346
+ xhr = new ActiveXObject("Microsoft.XMLHTTP");
347
+ } catch (_error) {
348
+ e = _error;
349
+ }
350
+ }
351
+ }
352
+ if (!xhr) {
353
+ throw "Unable to make Ajax Request";
354
+ }
355
+ xhr.onreadystatechange = callback;
356
+ xhr.open("GET", Teaspoon.root + "/fixtures/" + url, false);
357
+ return xhr.send();
358
+ };
359
+
360
+ return Fixture;
361
+
362
+ })();
363
+
364
+ }).call(this);
365
+ (function() {
366
+ Teaspoon.hook = function(name, payload) {
367
+ var xhr, xhrRequest;
368
+ if (payload == null) {
369
+ payload = {};
370
+ }
371
+ xhr = null;
372
+ xhrRequest = function(url, payload, callback) {
373
+ var e;
374
+ if (window.XMLHttpRequest) {
375
+ xhr = new XMLHttpRequest();
376
+ } else if (window.ActiveXObject) {
377
+ try {
378
+ xhr = new ActiveXObject("Msxml2.XMLHTTP");
379
+ } catch (_error) {
380
+ e = _error;
381
+ try {
382
+ xhr = new ActiveXObject("Microsoft.XMLHTTP");
383
+ } catch (_error) {
384
+ e = _error;
385
+ }
386
+ }
387
+ }
388
+ if (!xhr) {
389
+ throw "Unable to make Ajax Request";
390
+ }
391
+ xhr.onreadystatechange = callback;
392
+ xhr.open("POST", Teaspoon.root + "/" + url, false);
393
+ xhr.setRequestHeader("Content-Type", "application/json");
394
+ return xhr.send(JSON.stringify({
395
+ args: payload
396
+ }));
397
+ };
398
+ return xhrRequest(Teaspoon.suites.active + "/" + name, payload, function() {
399
+ if (xhr.readyState !== 4) {
400
+ return;
401
+ }
402
+ if (xhr.status !== 200) {
403
+ throw "Unable to call hook \"" + url + "\".";
404
+ }
405
+ });
406
+ };
407
+
408
+ }).call(this);
409
+ (function() {
410
+ Teaspoon.Reporters.BaseView = (function() {
411
+ function BaseView() {
412
+ this.elements = {};
413
+ this.build();
414
+ }
415
+
416
+ BaseView.prototype.build = function(className) {
417
+ return this.el = this.createEl("li", className);
418
+ };
419
+
420
+ BaseView.prototype.appendTo = function(el) {
421
+ return el.appendChild(this.el);
422
+ };
423
+
424
+ BaseView.prototype.append = function(el) {
425
+ return this.el.appendChild(el);
426
+ };
427
+
428
+ BaseView.prototype.createEl = function(type, className) {
429
+ var el;
430
+ if (className == null) {
431
+ className = "";
432
+ }
433
+ el = document.createElement(type);
434
+ el.className = className;
435
+ return el;
436
+ };
437
+
438
+ BaseView.prototype.findEl = function(id) {
439
+ var base;
440
+ this.elements || (this.elements = {});
441
+ return (base = this.elements)[id] || (base[id] = document.getElementById("teaspoon-" + id));
442
+ };
443
+
444
+ BaseView.prototype.setText = function(id, value) {
445
+ var el;
446
+ el = this.findEl(id);
447
+ return el.innerHTML = value;
448
+ };
449
+
450
+ BaseView.prototype.setHtml = function(id, value, add) {
451
+ var el;
452
+ if (add == null) {
453
+ add = false;
454
+ }
455
+ el = this.findEl(id);
456
+ if (add) {
457
+ return el.innerHTML += value;
458
+ } else {
459
+ return el.innerHTML = value;
460
+ }
461
+ };
462
+
463
+ BaseView.prototype.setClass = function(id, value) {
464
+ var el;
465
+ el = this.findEl(id);
466
+ return el.className = value;
467
+ };
468
+
469
+ BaseView.prototype.htmlSafe = function(str) {
470
+ var el;
471
+ el = document.createElement("div");
472
+ el.appendChild(document.createTextNode(str));
473
+ return el.innerHTML;
474
+ };
475
+
476
+ return BaseView;
477
+
478
+ })();
479
+
480
+ }).call(this);
481
+ (function() {
482
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
483
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
484
+ hasProp = {}.hasOwnProperty;
485
+
486
+ Teaspoon.Reporters.HTML = (function(superClass) {
487
+ extend(HTML, superClass);
488
+
489
+ function HTML() {
490
+ this.changeSuite = bind(this.changeSuite, this);
491
+ this.toggleConfig = bind(this.toggleConfig, this);
492
+ this.reportRunnerResults = bind(this.reportRunnerResults, this);
493
+ this.start = new Teaspoon.Date().getTime();
494
+ this.config = {
495
+ "use-catch": true,
496
+ "build-full-report": false,
497
+ "display-progress": true
498
+ };
499
+ this.total = {
500
+ exist: 0,
501
+ run: 0,
502
+ passes: 0,
503
+ failures: 0,
504
+ skipped: 0
505
+ };
506
+ this.views = {
507
+ specs: {},
508
+ suites: {}
509
+ };
510
+ this.filters = [];
511
+ this.setFilters();
512
+ this.readConfig();
513
+ HTML.__super__.constructor.apply(this, arguments);
514
+ }
515
+
516
+ HTML.prototype.build = function() {
517
+ var ref;
518
+ this.buildLayout();
519
+ this.setText("env-info", this.envInfo());
520
+ this.setText("version", Teaspoon.version);
521
+ this.findEl("toggles").onclick = this.toggleConfig;
522
+ this.findEl("suites").innerHTML = this.buildSuiteSelect();
523
+ if ((ref = this.findEl("suite-select")) != null) {
524
+ ref.onchange = this.changeSuite;
525
+ }
526
+ this.el = this.findEl("report-all");
527
+ this.showConfiguration();
528
+ this.buildProgress();
529
+ return this.buildFilters();
530
+ };
531
+
532
+ HTML.prototype.reportRunnerStarting = function(runner) {
533
+ this.total.exist = runner.total || 0;
534
+ if (this.total.exist) {
535
+ return this.setText("stats-duration", "...");
536
+ }
537
+ };
538
+
539
+ HTML.prototype.reportRunnerResults = function() {
540
+ if (!this.total.run) {
541
+ return;
542
+ }
543
+ this.setText("stats-duration", this.elapsedTime());
544
+ if (!this.total.failures) {
545
+ this.setStatus("passed");
546
+ }
547
+ this.setText("stats-passes", this.total.passes);
548
+ this.setText("stats-failures", this.total.failures);
549
+ if (this.total.run < this.total.exist) {
550
+ this.total.skipped = this.total.exist - this.total.run;
551
+ this.total.run = this.total.exist;
552
+ }
553
+ this.setText("stats-skipped", this.total.skipped);
554
+ return this.updateProgress();
555
+ };
556
+
557
+ HTML.prototype.reportSuiteStarting = function(suite) {};
558
+
559
+ HTML.prototype.reportSuiteResults = function(suite) {};
560
+
561
+ HTML.prototype.reportSpecStarting = function(spec) {
562
+ if (this.config["build-full-report"]) {
563
+ this.reportView = new (Teaspoon.resolveClass("Reporters.HTML.SpecView"))(spec, this);
564
+ }
565
+ return this.specStart = new Teaspoon.Date().getTime();
566
+ };
567
+
568
+ HTML.prototype.reportSpecResults = function(spec) {
569
+ this.total.run += 1;
570
+ this.updateProgress();
571
+ return this.updateStatus(spec);
572
+ };
573
+
574
+ HTML.prototype.buildLayout = function() {
575
+ var el;
576
+ el = this.createEl("div");
577
+ el.id = "teaspoon-interface";
578
+ el.innerHTML = (Teaspoon.resolveClass("Reporters.HTML")).template();
579
+ return document.body.appendChild(el);
580
+ };
581
+
582
+ HTML.prototype.buildSuiteSelect = function() {
583
+ var filename, i, len, options, path, ref, selected, suite;
584
+ if (Teaspoon.suites.all.length === 1) {
585
+ return "";
586
+ }
587
+ filename = "";
588
+ if (/index\.html$/.test(window.location.pathname)) {
589
+ filename = "/index.html";
590
+ }
591
+ options = [];
592
+ ref = Teaspoon.suites.all;
593
+ for (i = 0, len = ref.length; i < len; i++) {
594
+ suite = ref[i];
595
+ path = [Teaspoon.root, suite].join("/");
596
+ selected = Teaspoon.suites.active === suite ? " selected" : "";
597
+ options.push("<option" + selected + " value=\"" + path + filename + "\">" + suite + "</option>");
598
+ }
599
+ return "<select id=\"teaspoon-suite-select\">" + (options.join("")) + "</select>";
600
+ };
601
+
602
+ HTML.prototype.buildProgress = function() {
603
+ this.progress = Teaspoon.Reporters.HTML.ProgressView.create(this.config["display-progress"]);
604
+ return this.progress.appendTo(this.findEl("progress"));
605
+ };
606
+
607
+ HTML.prototype.buildFilters = function() {
608
+ if (this.filters.length) {
609
+ this.setClass("filter", "teaspoon-filtered");
610
+ }
611
+ return this.setHtml("filter-list", "<li>" + (this.filters.join("</li><li>")), true);
612
+ };
613
+
614
+ HTML.prototype.elapsedTime = function() {
615
+ return (((new Teaspoon.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
616
+ };
617
+
618
+ HTML.prototype.updateStat = function(name, value) {
619
+ if (!this.config["display-progress"]) {
620
+ return;
621
+ }
622
+ return this.setText("stats-" + name, value);
623
+ };
624
+
625
+ HTML.prototype.updateStatus = function(spec) {
626
+ var elapsed, ref, ref1, ref2, result;
627
+ result = spec.result();
628
+ if (result.skipped) {
629
+ this.updateStat("skipped", this.total.skipped += 1);
630
+ return;
631
+ }
632
+ elapsed = new Teaspoon.Date().getTime() - this.specStart;
633
+ if (result.status === "passed") {
634
+ this.updateStat("passes", this.total.passes += 1);
635
+ return (ref = this.reportView) != null ? ref.updateState("passed", elapsed) : void 0;
636
+ } else if (result.status === "pending") {
637
+ return (ref1 = this.reportView) != null ? ref1.updateState("pending", elapsed) : void 0;
638
+ } else {
639
+ this.updateStat("failures", this.total.failures += 1);
640
+ if ((ref2 = this.reportView) != null) {
641
+ ref2.updateState("failed", elapsed);
642
+ }
643
+ if (!this.config["build-full-report"]) {
644
+ new (Teaspoon.resolveClass("Reporters.HTML.FailureView"))(spec).appendTo(this.findEl("report-failures"));
645
+ }
646
+ return this.setStatus("failed");
647
+ }
648
+ };
649
+
650
+ HTML.prototype.updateProgress = function() {
651
+ return this.progress.update(this.total.exist, this.total.run);
652
+ };
653
+
654
+ HTML.prototype.showConfiguration = function() {
655
+ var key, ref, results, value;
656
+ ref = this.config;
657
+ results = [];
658
+ for (key in ref) {
659
+ value = ref[key];
660
+ results.push(this.setClass(key, value ? "active" : ""));
661
+ }
662
+ return results;
663
+ };
664
+
665
+ HTML.prototype.setStatus = function(status) {
666
+ return document.body.className = "teaspoon-" + status;
667
+ };
668
+
669
+ HTML.prototype.setFilters = function() {
670
+ if (Teaspoon.params["file"]) {
671
+ this.filters.push("by file: " + Teaspoon.params["file"]);
672
+ }
673
+ if (Teaspoon.params["grep"]) {
674
+ return this.filters.push("by match: " + Teaspoon.params["grep"]);
675
+ }
676
+ };
677
+
678
+ HTML.prototype.readConfig = function() {
679
+ var config;
680
+ if (config = this.store("teaspoon")) {
681
+ return this.config = config;
682
+ }
683
+ };
684
+
685
+ HTML.prototype.toggleConfig = function(e) {
686
+ var button, name;
687
+ button = e.target;
688
+ if (button.tagName.toLowerCase() !== "button") {
689
+ return;
690
+ }
691
+ name = button.getAttribute("id").replace(/^teaspoon-/, "");
692
+ this.config[name] = !this.config[name];
693
+ this.store("teaspoon", this.config);
694
+ return Teaspoon.reload();
695
+ };
696
+
697
+ HTML.prototype.changeSuite = function(e) {
698
+ var options;
699
+ options = e.target.options;
700
+ return window.location.href = options[options.selectedIndex].value;
701
+ };
702
+
703
+ HTML.prototype.store = function(name, value) {
704
+ var ref;
705
+ if (((ref = window.localStorage) != null ? ref.setItem : void 0) != null) {
706
+ return this.localstore(name, value);
707
+ } else {
708
+ return this.cookie(name, value);
709
+ }
710
+ };
711
+
712
+ HTML.prototype.cookie = function(name, value) {
713
+ var date, match;
714
+ if (value == null) {
715
+ value = void 0;
716
+ }
717
+ if (value === void 0) {
718
+ name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
719
+ match = document.cookie.match(new RegExp("(?:^|;)\\s?" + name + "=(.*?)(?:;|$)", "i"));
720
+ return match && JSON.parse(unescape(match[1]).split(" ")[0]);
721
+ } else {
722
+ date = new Teaspoon.Date();
723
+ date.setDate(date.getDate() + 365);
724
+ return document.cookie = name + "=" + (escape(JSON.stringify(value))) + "; expires=" + (date.toUTCString()) + "; path=/;";
725
+ }
726
+ };
727
+
728
+ HTML.prototype.localstore = function(name, value) {
729
+ if (value == null) {
730
+ value = void 0;
731
+ }
732
+ if (value === void 0) {
733
+ return JSON.parse(unescape(localStorage.getItem(name)));
734
+ } else {
735
+ return localStorage.setItem(name, escape(JSON.stringify(value)));
736
+ }
737
+ };
738
+
739
+ return HTML;
740
+
741
+ })(Teaspoon.Reporters.BaseView);
742
+
743
+ }).call(this);
744
+ (function() {
745
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
746
+ hasProp = {}.hasOwnProperty;
747
+
748
+ Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
749
+ extend(FailureView, superClass);
750
+
751
+ function FailureView(spec) {
752
+ this.spec = spec;
753
+ FailureView.__super__.constructor.apply(this, arguments);
754
+ }
755
+
756
+ FailureView.prototype.build = function() {
757
+ var error, html, i, len, ref;
758
+ FailureView.__super__.build.call(this, "spec");
759
+ html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
760
+ ref = this.spec.errors();
761
+ for (i = 0, len = ref.length; i < len; i++) {
762
+ error = ref[i];
763
+ html += "<div><strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
764
+ }
765
+ return this.el.innerHTML = html;
766
+ };
767
+
768
+ return FailureView;
769
+
770
+ })(Teaspoon.Reporters.BaseView);
771
+
772
+ }).call(this);
773
+ (function() {
774
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
775
+ hasProp = {}.hasOwnProperty;
776
+
777
+ Teaspoon.Reporters.HTML.ProgressView = (function(superClass) {
778
+ extend(ProgressView, superClass);
779
+
780
+ function ProgressView() {
781
+ return ProgressView.__super__.constructor.apply(this, arguments);
782
+ }
783
+
784
+ ProgressView.create = function(displayProgress) {
785
+ if (displayProgress == null) {
786
+ displayProgress = true;
787
+ }
788
+ if (!displayProgress) {
789
+ return new Teaspoon.Reporters.HTML.ProgressView();
790
+ }
791
+ if (Teaspoon.Reporters.HTML.RadialProgressView.supported) {
792
+ return new Teaspoon.Reporters.HTML.RadialProgressView();
793
+ } else {
794
+ return new Teaspoon.Reporters.HTML.SimpleProgressView();
795
+ }
796
+ };
797
+
798
+ ProgressView.prototype.build = function() {
799
+ return this.el = this.createEl("div", "teaspoon-indicator teaspoon-logo");
800
+ };
801
+
802
+ ProgressView.prototype.update = function() {};
803
+
804
+ return ProgressView;
805
+
806
+ })(Teaspoon.Reporters.BaseView);
807
+
808
+ }).call(this);
809
+ (function() {
810
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
811
+ hasProp = {}.hasOwnProperty;
812
+
813
+ Teaspoon.Reporters.HTML.RadialProgressView = (function(superClass) {
814
+ extend(RadialProgressView, superClass);
815
+
816
+ function RadialProgressView() {
817
+ return RadialProgressView.__super__.constructor.apply(this, arguments);
818
+ }
819
+
820
+ RadialProgressView.supported = !!document.createElement("canvas").getContext;
821
+
822
+ RadialProgressView.prototype.build = function() {
823
+ this.el = this.createEl("div", "teaspoon-indicator radial-progress");
824
+ return this.el.innerHTML = "<canvas id=\"teaspoon-progress-canvas\"></canvas>\n<em id=\"teaspoon-progress-percent\">0%</em>";
825
+ };
826
+
827
+ RadialProgressView.prototype.appendTo = function() {
828
+ var canvas, e;
829
+ RadialProgressView.__super__.appendTo.apply(this, arguments);
830
+ this.size = 80;
831
+ try {
832
+ canvas = this.findEl("progress-canvas");
833
+ canvas.width = canvas.height = canvas.style.width = canvas.style.height = this.size;
834
+ this.ctx = canvas.getContext("2d");
835
+ this.ctx.strokeStyle = "#fff";
836
+ return this.ctx.lineWidth = 1.5;
837
+ } catch (_error) {
838
+ e = _error;
839
+ }
840
+ };
841
+
842
+ RadialProgressView.prototype.update = function(total, run) {
843
+ var half, percent;
844
+ percent = total ? Math.ceil((run * 100) / total) : 0;
845
+ this.setHtml("progress-percent", percent + "%");
846
+ if (!this.ctx) {
847
+ return;
848
+ }
849
+ half = this.size / 2;
850
+ this.ctx.clearRect(0, 0, this.size, this.size);
851
+ this.ctx.beginPath();
852
+ this.ctx.arc(half, half, half - 1, 0, Math.PI * 2 * (percent / 100), false);
853
+ return this.ctx.stroke();
854
+ };
855
+
856
+ return RadialProgressView;
857
+
858
+ })(Teaspoon.Reporters.HTML.ProgressView);
859
+
860
+ }).call(this);
861
+ (function() {
862
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
863
+ hasProp = {}.hasOwnProperty;
864
+
865
+ Teaspoon.Reporters.HTML.SimpleProgressView = (function(superClass) {
866
+ extend(SimpleProgressView, superClass);
867
+
868
+ function SimpleProgressView() {
869
+ return SimpleProgressView.__super__.constructor.apply(this, arguments);
870
+ }
871
+
872
+ SimpleProgressView.prototype.build = function() {
873
+ this.el = this.createEl("div", "simple-progress");
874
+ return this.el.innerHTML = "<em id=\"teaspoon-progress-percent\">0%</em>\n<span id=\"teaspoon-progress-span\" class=\"teaspoon-indicator\"></span>";
875
+ };
876
+
877
+ SimpleProgressView.prototype.update = function(total, run) {
878
+ var percent;
879
+ percent = total ? Math.ceil((run * 100) / total) : 0;
880
+ return this.setHtml("progress-percent", percent + "%");
881
+ };
882
+
883
+ return SimpleProgressView;
884
+
885
+ })(Teaspoon.Reporters.HTML.ProgressView);
886
+
887
+ }).call(this);
888
+ (function() {
889
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
890
+ hasProp = {}.hasOwnProperty;
891
+
892
+ Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
893
+ var viewId;
894
+
895
+ extend(SpecView, superClass);
896
+
897
+ viewId = 0;
898
+
899
+ function SpecView(spec, reporter) {
900
+ this.spec = spec;
901
+ this.reporter = reporter;
902
+ this.views = this.reporter.views;
903
+ this.spec.viewId = viewId += 1;
904
+ this.views.specs[this.spec.viewId] = this;
905
+ SpecView.__super__.constructor.apply(this, arguments);
906
+ }
907
+
908
+ SpecView.prototype.build = function() {
909
+ var classes;
910
+ classes = ["spec"];
911
+ if (this.spec.pending) {
912
+ classes.push("state-pending");
913
+ }
914
+ SpecView.__super__.build.call(this, classes.join(" "));
915
+ this.el.innerHTML = "<a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.description)) + "</a>";
916
+ this.parentView = this.buildParent();
917
+ return this.parentView.append(this.el);
918
+ };
919
+
920
+ SpecView.prototype.buildParent = function() {
921
+ var parent, view;
922
+ parent = this.spec.parent;
923
+ if (parent.viewId) {
924
+ return this.views.suites[parent.viewId];
925
+ } else {
926
+ view = new (Teaspoon.resolveClass("Reporters.HTML.SuiteView"))(parent, this.reporter);
927
+ return this.views.suites[view.suite.viewId] = view;
928
+ }
929
+ };
930
+
931
+ SpecView.prototype.buildErrors = function() {
932
+ var div, error, html, i, len, ref;
933
+ div = this.createEl("div");
934
+ html = "";
935
+ ref = this.spec.errors();
936
+ for (i = 0, len = ref.length; i < len; i++) {
937
+ error = ref[i];
938
+ html += "<strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable"));
939
+ }
940
+ div.innerHTML = html;
941
+ return this.append(div);
942
+ };
943
+
944
+ SpecView.prototype.updateState = function(state, elapsed) {
945
+ var base, classes, result;
946
+ result = this.spec.result();
947
+ classes = ["state-" + state];
948
+ if (elapsed > Teaspoon.slow) {
949
+ classes.push("slow");
950
+ }
951
+ if (state === "passed") {
952
+ this.el.innerHTML += "<span>" + elapsed + "ms</span>";
953
+ }
954
+ this.el.className = classes.join(" ");
955
+ if (result.status === "failed") {
956
+ this.buildErrors();
957
+ }
958
+ return typeof (base = this.parentView).updateState === "function" ? base.updateState(state) : void 0;
959
+ };
960
+
961
+ return SpecView;
962
+
963
+ })(Teaspoon.Reporters.BaseView);
964
+
965
+ }).call(this);
966
+ (function() {
967
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
968
+ hasProp = {}.hasOwnProperty;
969
+
970
+ Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
971
+ var viewId;
972
+
973
+ extend(SuiteView, superClass);
974
+
975
+ viewId = 0;
976
+
977
+ function SuiteView(suite, reporter) {
978
+ this.suite = suite;
979
+ this.reporter = reporter;
980
+ this.views = this.reporter.views;
981
+ this.suite.viewId = viewId += 1;
982
+ this.views.suites[this.suite.viewId] = this;
983
+ this.suite = new (Teaspoon.resolveClass("Suite"))(this.suite);
984
+ SuiteView.__super__.constructor.apply(this, arguments);
985
+ }
986
+
987
+ SuiteView.prototype.build = function() {
988
+ SuiteView.__super__.build.call(this, "suite");
989
+ this.el.innerHTML = "<h1><a href=\"" + this.suite.link + "\">" + (this.htmlSafe(this.suite.description)) + "</a></h1>";
990
+ this.parentView = this.buildParent();
991
+ return this.parentView.append(this.el);
992
+ };
993
+
994
+ SuiteView.prototype.buildParent = function() {
995
+ var parent, view;
996
+ parent = this.suite.parent;
997
+ if (!parent) {
998
+ return this.reporter;
999
+ }
1000
+ if (parent.viewId) {
1001
+ return this.views.suites[parent.viewId];
1002
+ } else {
1003
+ view = new (Teaspoon.resolveClass("Reporters.HTML.SuiteView"))(parent, this.reporter);
1004
+ return this.views.suites[view.suite.viewId] = view;
1005
+ }
1006
+ };
1007
+
1008
+ SuiteView.prototype.append = function(el) {
1009
+ if (!this.ol) {
1010
+ SuiteView.__super__.append.call(this, this.ol = this.createEl("ol"));
1011
+ }
1012
+ return this.ol.appendChild(el);
1013
+ };
1014
+
1015
+ SuiteView.prototype.updateState = function(state) {
1016
+ var base;
1017
+ if (this.state === "failed") {
1018
+ return;
1019
+ }
1020
+ this.el.className = (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
1021
+ if (typeof (base = this.parentView).updateState === "function") {
1022
+ base.updateState(state);
1023
+ }
1024
+ return this.state = state;
1025
+ };
1026
+
1027
+ return SuiteView;
1028
+
1029
+ })(Teaspoon.Reporters.BaseView);
1030
+
1031
+ }).call(this);
1032
+ (function() {
1033
+ Teaspoon.Reporters.HTML.template = function() {
1034
+ return "<div class=\"teaspoon-clearfix\">\n <div id=\"teaspoon-title\">\n <h1><a href=\"" + Teaspoon.root + "\" id=\"teaspoon-root-link\">Teaspoon</a></h1>\n <ul>\n <li>version: <b id=\"teaspoon-version\"></b></li>\n <li id=\"teaspoon-env-info\"></li>\n </ul>\n </div>\n <div id=\"teaspoon-progress\"></div>\n <ul id=\"teaspoon-stats\">\n <li>passes: <b id=\"teaspoon-stats-passes\">0</b></li>\n <li>failures: <b id=\"teaspoon-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teaspoon-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teaspoon-stats-duration\">&infin;</b></li>\n </ul>\n</div>\n\n<div id=\"teaspoon-controls\" class=\"teaspoon-clearfix\">\n <div id=\"teaspoon-toggles\">\n <button id=\"teaspoon-use-catch\" title=\"Toggle using try/catch wrappers when possible\">Try/Catch</button>\n <button id=\"teaspoon-build-full-report\" title=\"Toggle building the full report\">Full Report</button>\n <button id=\"teaspoon-display-progress\" title=\"Toggle displaying progress as tests run\">Progress</button>\n </div>\n <div id=\"teaspoon-suites\"></div>\n</div>\n\n<hr/>\n\n<div id=\"teaspoon-filter\">\n <h1>Applied Filters [<a href=\"" + window.location.pathname + "\" id=\"teaspoon-filter-clear\">remove</a>]</h1>\n <ul id=\"teaspoon-filter-list\"></ul>\n</div>\n\n<div id=\"teaspoon-report\">\n <ol id=\"teaspoon-report-failures\"></ol>\n <ol id=\"teaspoon-report-all\"></ol>\n</div>";
1035
+ };
1036
+
1037
+ }).call(this);
1038
+ (function() {
1039
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
1040
+
1041
+ Teaspoon.Reporters.Console = (function() {
1042
+ function Console() {
1043
+ this.reportRunnerResults = bind(this.reportRunnerResults, this);
1044
+ this.start = new Teaspoon.Date();
1045
+ this.suites = {};
1046
+ }
1047
+
1048
+ Console.prototype.reportRunnerStarting = function(runner) {
1049
+ return this.log({
1050
+ type: "runner",
1051
+ total: runner.total || (typeof runner.specs === "function" ? runner.specs().length : void 0) || 0,
1052
+ start: JSON.parse(JSON.stringify(this.start))
1053
+ });
1054
+ };
1055
+
1056
+ Console.prototype.reportRunnerResults = function() {
1057
+ this.log({
1058
+ type: "result",
1059
+ elapsed: ((new Teaspoon.Date().getTime() - this.start.getTime()) / 1000).toFixed(5),
1060
+ coverage: window.__coverage__
1061
+ });
1062
+ return Teaspoon.finished = true;
1063
+ };
1064
+
1065
+ Console.prototype.reportSuiteStarting = function(suite) {};
1066
+
1067
+ Console.prototype.reportSuiteResults = function(suite) {};
1068
+
1069
+ Console.prototype.reportSpecStarting = function(spec) {};
1070
+
1071
+ Console.prototype.reportSuites = function() {
1072
+ var i, index, len, ref, results, suite;
1073
+ ref = this.spec.getParents();
1074
+ results = [];
1075
+ for (index = i = 0, len = ref.length; i < len; index = ++i) {
1076
+ suite = ref[index];
1077
+ if (this.suites[suite.fullDescription]) {
1078
+ continue;
1079
+ }
1080
+ this.suites[suite.fullDescription] = true;
1081
+ results.push(this.log({
1082
+ type: "suite",
1083
+ label: suite.description,
1084
+ level: index
1085
+ }));
1086
+ }
1087
+ return results;
1088
+ };
1089
+
1090
+ Console.prototype.reportSpecResults = function(spec1) {
1091
+ var result;
1092
+ this.spec = spec1;
1093
+ result = this.spec.result();
1094
+ if (result.skipped) {
1095
+ return;
1096
+ }
1097
+ this.reportSuites();
1098
+ switch (result.status) {
1099
+ case "pending":
1100
+ return this.trackPending();
1101
+ case "failed":
1102
+ return this.trackFailure();
1103
+ default:
1104
+ return this.log({
1105
+ type: "spec",
1106
+ suite: this.spec.suiteName,
1107
+ label: this.spec.description,
1108
+ status: result.status,
1109
+ skipped: result.skipped
1110
+ });
1111
+ }
1112
+ };
1113
+
1114
+ Console.prototype.trackPending = function() {
1115
+ var result;
1116
+ result = this.spec.result();
1117
+ return this.log({
1118
+ type: "spec",
1119
+ suite: this.spec.suiteName,
1120
+ label: this.spec.description,
1121
+ status: result.status,
1122
+ skipped: result.skipped
1123
+ });
1124
+ };
1125
+
1126
+ Console.prototype.trackFailure = function() {
1127
+ var error, i, len, ref, result, results;
1128
+ result = this.spec.result();
1129
+ ref = this.spec.errors();
1130
+ results = [];
1131
+ for (i = 0, len = ref.length; i < len; i++) {
1132
+ error = ref[i];
1133
+ results.push(this.log({
1134
+ type: "spec",
1135
+ suite: this.spec.suiteName,
1136
+ label: this.spec.description,
1137
+ status: result.status,
1138
+ skipped: result.skipped,
1139
+ link: this.spec.fullDescription,
1140
+ message: error.message,
1141
+ trace: error.stack || error.message || "Stack Trace Unavailable"
1142
+ }));
1143
+ }
1144
+ return results;
1145
+ };
1146
+
1147
+ Console.prototype.log = function(obj) {
1148
+ if (obj == null) {
1149
+ obj = {};
1150
+ }
1151
+ obj["_teaspoon"] = true;
1152
+ return Teaspoon.log(JSON.stringify(obj));
1153
+ };
1154
+
1155
+ return Console;
1156
+
1157
+ })();
1158
+
1159
+ }).call(this);
1160
+ (function() {
1161
+ var base, base1;
1162
+
1163
+ if (typeof jasmineRequire === "undefined" || jasmineRequire === null) {
1164
+ throw new Teaspoon.Error('Jasmine 2 not found -- use `suite.use_framework :jasmine` and adjust or remove the `suite.javascripts` directive.');
1165
+ }
1166
+
1167
+ if (this.Teaspoon == null) {
1168
+ this.Teaspoon = {};
1169
+ }
1170
+
1171
+ if ((base = this.Teaspoon).Jasmine2 == null) {
1172
+ base.Jasmine2 = {};
1173
+ }
1174
+
1175
+ if ((base1 = this.Teaspoon.Jasmine2).Reporters == null) {
1176
+ base1.Reporters = {};
1177
+ }
1178
+
1179
+ }).call(this);
1180
+ (function() {
1181
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1182
+ hasProp = {}.hasOwnProperty;
1183
+
1184
+ Teaspoon.Jasmine2.Fixture = (function(superClass) {
1185
+ extend(Fixture, superClass);
1186
+
1187
+ function Fixture() {
1188
+ return Fixture.__super__.constructor.apply(this, arguments);
1189
+ }
1190
+
1191
+ Fixture.load = function() {
1192
+ var args;
1193
+ args = arguments;
1194
+ this.env().beforeEach((function(_this) {
1195
+ return function() {
1196
+ return fixture.__super__.constructor.load.apply(_this, args);
1197
+ };
1198
+ })(this));
1199
+ this.env().afterEach((function(_this) {
1200
+ return function() {
1201
+ return _this.cleanup();
1202
+ };
1203
+ })(this));
1204
+ return Fixture.__super__.constructor.load.apply(this, arguments);
1205
+ };
1206
+
1207
+ Fixture.set = function() {
1208
+ var args;
1209
+ args = arguments;
1210
+ this.env().beforeEach((function(_this) {
1211
+ return function() {
1212
+ return fixture.__super__.constructor.set.apply(_this, args);
1213
+ };
1214
+ })(this));
1215
+ this.env().afterEach((function(_this) {
1216
+ return function() {
1217
+ return _this.cleanup();
1218
+ };
1219
+ })(this));
1220
+ return Fixture.__super__.constructor.set.apply(this, arguments);
1221
+ };
1222
+
1223
+ Fixture.env = function() {
1224
+ return window.jasmine.getEnv();
1225
+ };
1226
+
1227
+ return Fixture;
1228
+
1229
+ })(Teaspoon.Fixture);
1230
+
1231
+ }).call(this);
1232
+ (function() {
1233
+ var env, extend, setupSpecFilter;
1234
+
1235
+ Teaspoon.setFramework(Teaspoon.Jasmine2);
1236
+
1237
+ setupSpecFilter = function(env) {
1238
+ var grep;
1239
+ if (grep = Teaspoon.Runner.prototype.getParams()["grep"]) {
1240
+ return env.specFilter = function(spec) {
1241
+ return spec.getFullName().indexOf(grep) === 0;
1242
+ };
1243
+ }
1244
+ };
1245
+
1246
+ extend = function(destination, source) {
1247
+ var property;
1248
+ for (property in source) {
1249
+ destination[property] = source[property];
1250
+ }
1251
+ return destination;
1252
+ };
1253
+
1254
+ window.jasmine = jasmineRequire.core(jasmineRequire);
1255
+
1256
+ env = window.jasmine.getEnv();
1257
+
1258
+ setupSpecFilter(env);
1259
+
1260
+ extend(window, jasmineRequire["interface"](jasmine, env));
1261
+
1262
+ }).call(this);
1263
+ (function() {
1264
+ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
1265
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1266
+ hasProp = {}.hasOwnProperty;
1267
+
1268
+ Teaspoon.Jasmine2.Reporters.Console = (function(superClass) {
1269
+ extend(Console, superClass);
1270
+
1271
+ function Console() {
1272
+ this.reportRunnerResults = bind(this.reportRunnerResults, this);
1273
+ return Console.__super__.constructor.apply(this, arguments);
1274
+ }
1275
+
1276
+ Console.prototype.reportRunnerStarting = function() {
1277
+ this.currentAssertions = [];
1278
+ return this.log({
1279
+ type: "runner",
1280
+ total: null,
1281
+ start: JSON.parse(JSON.stringify(this.start))
1282
+ });
1283
+ };
1284
+
1285
+ Console.prototype.reportRunnerResults = function() {
1286
+ this.log({
1287
+ type: "result",
1288
+ elapsed: ((new Teaspoon.Date().getTime() - this.start.getTime()) / 1000).toFixed(5),
1289
+ coverage: window.__coverage__
1290
+ });
1291
+ return Teaspoon.finished = true;
1292
+ };
1293
+
1294
+ return Console;
1295
+
1296
+ })(Teaspoon.Reporters.Console);
1297
+
1298
+ }).call(this);
1299
+ (function() {
1300
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1301
+ hasProp = {}.hasOwnProperty;
1302
+
1303
+ Teaspoon.Jasmine2.Reporters.HTML = (function(superClass) {
1304
+ extend(HTML, superClass);
1305
+
1306
+ function HTML() {
1307
+ return HTML.__super__.constructor.apply(this, arguments);
1308
+ }
1309
+
1310
+ HTML.prototype.readConfig = function() {
1311
+ HTML.__super__.readConfig.apply(this, arguments);
1312
+ return jasmine.CATCH_EXCEPTIONS = this.config["use-catch"];
1313
+ };
1314
+
1315
+ HTML.prototype.envInfo = function() {
1316
+ return "jasmine " + jasmine.version;
1317
+ };
1318
+
1319
+ return HTML;
1320
+
1321
+ })(Teaspoon.Reporters.HTML);
1322
+
1323
+ }).call(this);
1324
+ (function() {
1325
+ Teaspoon.Jasmine2.Responder = (function() {
1326
+ function Responder(reporter) {
1327
+ this.reporter = reporter;
1328
+ }
1329
+
1330
+ Responder.prototype.jasmineStarted = function(runner) {
1331
+ return this.reporter.reportRunnerStarting({
1332
+ total: runner.totalSpecsDefined
1333
+ });
1334
+ };
1335
+
1336
+ Responder.prototype.jasmineDone = function() {
1337
+ return this.reporter.reportRunnerResults();
1338
+ };
1339
+
1340
+ Responder.prototype.suiteStarted = function(suite) {
1341
+ if (this.currentSuite) {
1342
+ suite.parent = this.currentSuite;
1343
+ }
1344
+ this.currentSuite = suite;
1345
+ return this.reporter.reportSuiteStarting(new Teaspoon.Jasmine2.Suite(suite));
1346
+ };
1347
+
1348
+ Responder.prototype.suiteDone = function(suite) {
1349
+ this.currentSuite = this.currentSuite.parent;
1350
+ return this.reporter.reportSuiteResults(new Teaspoon.Jasmine2.Suite(suite));
1351
+ };
1352
+
1353
+ Responder.prototype.specStarted = function(spec) {
1354
+ if (jasmine.getEnv().specFilter({
1355
+ getFullName: function() {
1356
+ return spec.fullName;
1357
+ }
1358
+ })) {
1359
+ spec.parent = this.currentSuite;
1360
+ return this.reporter.reportSpecStarting(new Teaspoon.Jasmine2.Spec(spec));
1361
+ }
1362
+ };
1363
+
1364
+ Responder.prototype.specDone = function(spec) {
1365
+ spec.parent = this.currentSuite;
1366
+ return this.reporter.reportSpecResults(new Teaspoon.Jasmine2.Spec(spec));
1367
+ };
1368
+
1369
+ return Responder;
1370
+
1371
+ })();
1372
+
1373
+ }).call(this);
1374
+ (function() {
1375
+ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1376
+ hasProp = {}.hasOwnProperty;
1377
+
1378
+ Teaspoon.Jasmine2.Runner = (function(superClass) {
1379
+ extend(Runner, superClass);
1380
+
1381
+ function Runner() {
1382
+ this.env = window.jasmine.getEnv();
1383
+ Runner.__super__.constructor.apply(this, arguments);
1384
+ this.env.execute();
1385
+ }
1386
+
1387
+ Runner.prototype.setup = function() {
1388
+ var reporter, responder;
1389
+ reporter = new (this.getReporter())();
1390
+ responder = new Teaspoon.Jasmine2.Responder(reporter);
1391
+ this.env.addReporter(responder);
1392
+ return this.addFixtureSupport();
1393
+ };
1394
+
1395
+ Runner.prototype.addFixtureSupport = function() {
1396
+ if (!(jasmine.getFixtures && this.fixturePath)) {
1397
+ return;
1398
+ }
1399
+ jasmine.getFixtures().containerId = "teaspoon-fixtures";
1400
+ jasmine.getFixtures().fixturesPath = this.fixturePath;
1401
+ jasmine.getStyleFixtures().fixturesPath = this.fixturePath;
1402
+ return jasmine.getJSONFixtures().fixturesPath = this.fixturePath;
1403
+ };
1404
+
1405
+ return Runner;
1406
+
1407
+ })(Teaspoon.Runner);
1408
+
1409
+ }).call(this);
1410
+ (function() {
1411
+ Teaspoon.Jasmine2.Spec = (function() {
1412
+ function Spec(spec) {
1413
+ this.spec = spec;
1414
+ this.fullDescription = this.spec.fullName;
1415
+ this.description = this.spec.description;
1416
+ this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
1417
+ this.parent = this.spec.parent;
1418
+ this.suiteName = this.parent.fullName;
1419
+ this.viewId = this.spec.id;
1420
+ this.pending = this.spec.status === "pending";
1421
+ }
1422
+
1423
+ Spec.prototype.errors = function() {
1424
+ var i, item, len, ref, results;
1425
+ if (!this.spec.failedExpectations.length) {
1426
+ return [];
1427
+ }
1428
+ ref = this.spec.failedExpectations;
1429
+ results = [];
1430
+ for (i = 0, len = ref.length; i < len; i++) {
1431
+ item = ref[i];
1432
+ results.push({
1433
+ message: item.message,
1434
+ stack: item.stack
1435
+ });
1436
+ }
1437
+ return results;
1438
+ };
1439
+
1440
+ Spec.prototype.getParents = function() {
1441
+ var parent;
1442
+ if (this.parents) {
1443
+ return this.parents;
1444
+ }
1445
+ this.parents || (this.parents = []);
1446
+ parent = this.parent;
1447
+ while (parent) {
1448
+ parent = new Teaspoon.Jasmine2.Suite(parent);
1449
+ this.parents.unshift(parent);
1450
+ parent = parent.parent;
1451
+ }
1452
+ return this.parents;
1453
+ };
1454
+
1455
+ Spec.prototype.result = function() {
1456
+ return {
1457
+ status: this.status(),
1458
+ skipped: this.spec.status === "disabled"
1459
+ };
1460
+ };
1461
+
1462
+ Spec.prototype.status = function() {
1463
+ if (this.spec.status === "disabled") {
1464
+ return "passed";
1465
+ } else {
1466
+ return this.spec.status;
1467
+ }
1468
+ };
1469
+
1470
+ return Spec;
1471
+
1472
+ })();
1473
+
1474
+ }).call(this);
1475
+ (function() {
1476
+ Teaspoon.Jasmine2.Suite = (function() {
1477
+ function Suite(suite) {
1478
+ this.suite = suite;
1479
+ this.fullDescription = this.suite.fullName;
1480
+ this.description = this.suite.description;
1481
+ this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
1482
+ this.parent = this.suite.parent;
1483
+ this.viewId = this.suite.id;
1484
+ }
1485
+
1486
+ return Suite;
1487
+
1488
+ })();
1489
+
1490
+ }).call(this);