teaspoon 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT.LICENSE +1 -1
- data/README.md +46 -377
- data/app/assets/javascripts/teaspoon-jasmine.js +200 -194
- data/app/assets/javascripts/teaspoon-mocha.js +183 -185
- data/app/assets/javascripts/teaspoon-qunit.js +201 -193
- data/app/assets/javascripts/teaspoon-teaspoon.js +10 -10
- data/app/assets/javascripts/teaspoon/base/fixture.coffee +0 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +7 -6
- data/app/assets/javascripts/teaspoon/qunit.coffee +10 -0
- data/app/controllers/teaspoon/suite_controller.rb +3 -4
- data/app/views/teaspoon/suite/_boot.html.erb +1 -1
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +1 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +4 -14
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/jasmine/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +5 -5
- data/lib/generators/teaspoon/install/templates/mocha/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +5 -5
- data/lib/tasks/teaspoon.rake +1 -1
- data/lib/teaspoon/command_line.rb +37 -40
- data/lib/teaspoon/configuration.rb +27 -30
- data/lib/teaspoon/configuration.rb.orig +187 -0
- data/lib/teaspoon/console.rb +31 -17
- data/lib/teaspoon/coverage.rb +2 -3
- data/lib/teaspoon/deprecated.rb +13 -8
- data/lib/teaspoon/drivers/base.rb +2 -2
- data/lib/teaspoon/drivers/capybara_webkit_driver.rb +33 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +2 -2
- data/lib/teaspoon/drivers/phantomjs_driver.rb +13 -4
- data/lib/teaspoon/drivers/selenium_driver.rb +3 -5
- data/lib/teaspoon/engine.rb +33 -5
- data/lib/teaspoon/environment.rb +2 -4
- data/lib/teaspoon/exceptions.rb +8 -5
- data/lib/teaspoon/formatters/base.rb +39 -27
- data/lib/teaspoon/formatters/clean_formatter.rb +0 -1
- data/lib/teaspoon/formatters/description.rb +36 -0
- data/lib/teaspoon/formatters/documentation_formatter.rb +2 -2
- data/lib/teaspoon/formatters/json_formatter.rb +1 -2
- data/lib/teaspoon/formatters/junit_formatter.rb +20 -20
- data/lib/teaspoon/formatters/modules/report_module.rb +4 -4
- data/lib/teaspoon/formatters/pride_formatter.rb +0 -1
- data/lib/teaspoon/formatters/rspec_html_formatter.rb +463 -0
- data/lib/teaspoon/formatters/snowday_formatter.rb +0 -1
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +5 -4
- data/lib/teaspoon/formatters/tap_formatter.rb +2 -3
- data/lib/teaspoon/formatters/tap_y_formatter.rb +20 -21
- data/lib/teaspoon/formatters/teamcity_formatter.rb +4 -5
- data/lib/teaspoon/instrumentation.rb +7 -7
- data/lib/teaspoon/result.rb +1 -3
- data/lib/teaspoon/runner.rb +1 -2
- data/lib/teaspoon/server.rb +2 -1
- data/lib/teaspoon/suite.rb +20 -17
- data/lib/teaspoon/utility.rb +1 -3
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/config/application.rb +14 -18
- data/spec/dummy/config/boot.rb +2 -6
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/config/environments/development.rb +27 -13
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +26 -13
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/features/console_reporter_spec.rb +3 -8
- data/spec/features/hooks_spec.rb +17 -4
- data/spec/features/html_reporter_spec.rb +12 -1
- data/spec/features/install_generator_spec.rb +2 -3
- data/spec/features/instrumentation_spec.rb +11 -11
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +14 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/teaspoon/command_line_spec.rb +19 -28
- data/spec/teaspoon/configuration_spec.rb +22 -14
- data/spec/teaspoon/console_spec.rb +79 -63
- data/spec/teaspoon/coverage_spec.rb +23 -23
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +39 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +10 -5
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +10 -10
- data/spec/teaspoon/environment_spec.rb +28 -20
- data/spec/teaspoon/exceptions_spec.rb +4 -4
- data/spec/teaspoon/exporter_spec.rb +28 -28
- data/spec/teaspoon/formatters/base_spec.rb +29 -29
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/json_formatter_spec.rb +7 -7
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +10 -10
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +107 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +27 -27
- data/spec/teaspoon/instrumentation_spec.rb +35 -29
- data/spec/teaspoon/result_spec.rb +40 -36
- data/spec/teaspoon/runner_spec.rb +23 -20
- data/spec/teaspoon/server_spec.rb +19 -16
- data/spec/teaspoon/suite_spec.rb +23 -9
- data/spec/teaspoon_env.rb +7 -12
- data/test/javascripts/teaspoon/qunit/models_test.coffee +6 -2
- data/vendor/assets/javascripts/support/chai-1.10.0.js +4800 -0
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +524 -0
- data/vendor/assets/javascripts/support/chai.js +4435 -4349
- metadata +57 -54
- data/app/assets/javascripts/teaspoon-angular.js +0 -1299
- data/app/assets/javascripts/teaspoon/angular.coffee +0 -55
- data/app/assets/javascripts/teaspoon/angular/reporters/console.coffee +0 -11
- data/app/assets/javascripts/teaspoon/angular/reporters/html.coffee +0 -21
- data/spec/javascripts/angular_helper.coffee +0 -5
- data/spec/javascripts/teaspoon/angular/models_aspec.coffee +0 -95
- data/spec/javascripts/teaspoon/angular/reporters/html_aspec.coffee +0 -9
- data/vendor/assets/javascripts/angular/1.0.5.js +0 -26195
- data/vendor/assets/javascripts/angular/MIT-LICENSE +0 -22
@@ -1,6 +1,6 @@
|
|
1
1
|
(function() {
|
2
|
-
var
|
3
|
-
|
2
|
+
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; },
|
3
|
+
hasProp = {}.hasOwnProperty;
|
4
4
|
|
5
5
|
this.Teaspoon = (function() {
|
6
6
|
function Teaspoon() {}
|
@@ -51,7 +51,7 @@
|
|
51
51
|
};
|
52
52
|
|
53
53
|
Teaspoon.resolveDependenciesFromParams = function(all) {
|
54
|
-
var dep, deps, file,
|
54
|
+
var dep, deps, file, i, j, len, len1, parts, path, paths;
|
55
55
|
if (all == null) {
|
56
56
|
all = [];
|
57
57
|
}
|
@@ -59,15 +59,15 @@
|
|
59
59
|
if ((paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) === null) {
|
60
60
|
return all;
|
61
61
|
}
|
62
|
-
for (
|
63
|
-
path = paths[
|
62
|
+
for (i = 0, len = paths.length; i < len; i++) {
|
63
|
+
path = paths[i];
|
64
64
|
parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i);
|
65
65
|
if (parts === null) {
|
66
66
|
continue;
|
67
67
|
}
|
68
68
|
file = parts[1].substr(parts[1].lastIndexOf("/") + 1);
|
69
|
-
for (
|
70
|
-
dep = all[
|
69
|
+
for (j = 0, len1 = all.length; j < len1; j++) {
|
70
|
+
dep = all[j];
|
71
71
|
if (dep.indexOf(file) >= 0) {
|
72
72
|
deps.push(dep);
|
73
73
|
}
|
@@ -98,8 +98,8 @@
|
|
98
98
|
|
99
99
|
})();
|
100
100
|
|
101
|
-
Teaspoon.Error = (function(
|
102
|
-
|
101
|
+
Teaspoon.Error = (function(superClass) {
|
102
|
+
extend(Error, superClass);
|
103
103
|
|
104
104
|
function Error(message) {
|
105
105
|
this.name = "TeaspoonError";
|
@@ -120,18 +120,18 @@
|
|
120
120
|
return;
|
121
121
|
}
|
122
122
|
this.constructor.run = true;
|
123
|
-
this.fixturePath =
|
123
|
+
this.fixturePath = Teaspoon.root + "/fixtures";
|
124
124
|
this.params = Teaspoon.params = this.getParams();
|
125
125
|
this.setup();
|
126
126
|
}
|
127
127
|
|
128
128
|
Runner.prototype.getParams = function() {
|
129
|
-
var
|
129
|
+
var i, len, name, param, params, ref, ref1, value;
|
130
130
|
params = {};
|
131
|
-
|
132
|
-
for (
|
133
|
-
param =
|
134
|
-
|
131
|
+
ref = Teaspoon.location.search.substring(1).split("&");
|
132
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
133
|
+
param = ref[i];
|
134
|
+
ref1 = param.split("="), name = ref1[0], value = ref1[1];
|
135
135
|
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
136
136
|
}
|
137
137
|
return params;
|
@@ -157,11 +157,10 @@
|
|
157
157
|
|
158
158
|
}).call(this);
|
159
159
|
(function() {
|
160
|
-
var
|
160
|
+
var slice = [].slice;
|
161
161
|
|
162
162
|
Teaspoon.fixture = (function() {
|
163
|
-
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest
|
164
|
-
_this = this;
|
163
|
+
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
165
164
|
|
166
165
|
fixture.cache = {};
|
167
166
|
|
@@ -172,19 +171,19 @@
|
|
172
171
|
fixture.json = [];
|
173
172
|
|
174
173
|
fixture.preload = function() {
|
175
|
-
var
|
176
|
-
urls = 1 <= arguments.length ?
|
177
|
-
|
178
|
-
for (
|
179
|
-
url = urls[
|
180
|
-
|
174
|
+
var i, len, results, url, urls;
|
175
|
+
urls = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
176
|
+
results = [];
|
177
|
+
for (i = 0, len = urls.length; i < len; i++) {
|
178
|
+
url = urls[i];
|
179
|
+
results.push(preload(url));
|
181
180
|
}
|
182
|
-
return
|
181
|
+
return results;
|
183
182
|
};
|
184
183
|
|
185
184
|
fixture.load = function() {
|
186
|
-
var append,
|
187
|
-
urls = 2 <= arguments.length ?
|
185
|
+
var append, i, index, j, len, results, url, urls;
|
186
|
+
urls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
188
187
|
if (append == null) {
|
189
188
|
append = false;
|
190
189
|
}
|
@@ -192,17 +191,17 @@
|
|
192
191
|
urls.push(append);
|
193
192
|
append = false;
|
194
193
|
}
|
195
|
-
|
196
|
-
for (index =
|
194
|
+
results = [];
|
195
|
+
for (index = j = 0, len = urls.length; j < len; index = ++j) {
|
197
196
|
url = urls[index];
|
198
|
-
|
197
|
+
results.push(load(url, append || index > 0));
|
199
198
|
}
|
200
|
-
return
|
199
|
+
return results;
|
201
200
|
};
|
202
201
|
|
203
202
|
fixture.set = function() {
|
204
|
-
var append, html, htmls,
|
205
|
-
htmls = 2 <= arguments.length ?
|
203
|
+
var append, html, htmls, i, index, j, len, results;
|
204
|
+
htmls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
206
205
|
if (append == null) {
|
207
206
|
append = false;
|
208
207
|
}
|
@@ -210,12 +209,12 @@
|
|
210
209
|
htmls.push(append);
|
211
210
|
append = false;
|
212
211
|
}
|
213
|
-
|
214
|
-
for (index =
|
212
|
+
results = [];
|
213
|
+
for (index = j = 0, len = htmls.length; j < len; index = ++j) {
|
215
214
|
html = htmls[index];
|
216
|
-
|
215
|
+
results.push(set(html, append || index > 0));
|
217
216
|
}
|
218
|
-
return
|
217
|
+
return results;
|
219
218
|
};
|
220
219
|
|
221
220
|
fixture.cleanup = function() {
|
@@ -294,21 +293,21 @@
|
|
294
293
|
};
|
295
294
|
|
296
295
|
create = function() {
|
297
|
-
var
|
296
|
+
var ref;
|
298
297
|
Teaspoon.fixture.el = document.createElement("div");
|
299
298
|
if (typeof window.$ === 'function') {
|
300
299
|
Teaspoon.fixture.$el = $(Teaspoon.fixture.el);
|
301
300
|
}
|
302
301
|
Teaspoon.fixture.el.id = "teaspoon-fixtures";
|
303
|
-
return (
|
302
|
+
return (ref = document.body) != null ? ref.appendChild(Teaspoon.fixture.el) : void 0;
|
304
303
|
};
|
305
304
|
|
306
305
|
cleanup = function() {
|
307
|
-
var
|
308
|
-
(
|
309
|
-
if ((
|
310
|
-
if ((
|
311
|
-
|
306
|
+
var base, ref, ref1;
|
307
|
+
(base = Teaspoon.fixture).el || (base.el = document.getElementById("teaspoon-fixtures"));
|
308
|
+
if ((ref = Teaspoon.fixture.el) != null) {
|
309
|
+
if ((ref1 = ref.parentNode) != null) {
|
310
|
+
ref1.removeChild(Teaspoon.fixture.el);
|
312
311
|
}
|
313
312
|
}
|
314
313
|
return Teaspoon.fixture.el = null;
|
@@ -334,23 +333,24 @@
|
|
334
333
|
throw "Unable to make Ajax Request";
|
335
334
|
}
|
336
335
|
xhr.onreadystatechange = callback;
|
337
|
-
xhr.open("GET",
|
336
|
+
xhr.open("GET", Teaspoon.root + "/fixtures/" + url, false);
|
338
337
|
return xhr.send();
|
339
338
|
};
|
340
339
|
|
341
340
|
return fixture;
|
342
341
|
|
343
|
-
})
|
342
|
+
})();
|
344
343
|
|
345
344
|
}).call(this);
|
346
345
|
(function() {
|
347
|
-
Teaspoon.hook = function(name,
|
348
|
-
var xhr, xhrRequest;
|
349
|
-
if (
|
350
|
-
|
346
|
+
Teaspoon.hook = function(name, payload) {
|
347
|
+
var method, xhr, xhrRequest;
|
348
|
+
if (payload == null) {
|
349
|
+
payload = {};
|
351
350
|
}
|
351
|
+
method = "POST";
|
352
352
|
xhr = null;
|
353
|
-
xhrRequest = function(url,
|
353
|
+
xhrRequest = function(url, payload, callback) {
|
354
354
|
var e;
|
355
355
|
if (window.XMLHttpRequest) {
|
356
356
|
xhr = new XMLHttpRequest();
|
@@ -370,10 +370,13 @@
|
|
370
370
|
throw "Unable to make Ajax Request";
|
371
371
|
}
|
372
372
|
xhr.onreadystatechange = callback;
|
373
|
-
xhr.open(
|
374
|
-
|
373
|
+
xhr.open("POST", Teaspoon.root + "/" + url, false);
|
374
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
375
|
+
return xhr.send(JSON.stringify({
|
376
|
+
args: payload
|
377
|
+
}));
|
375
378
|
};
|
376
|
-
return xhrRequest(
|
379
|
+
return xhrRequest(Teaspoon.suites.active + "/" + name, payload, function() {
|
377
380
|
if (xhr.readyState !== 4) {
|
378
381
|
return;
|
379
382
|
}
|
@@ -414,9 +417,9 @@
|
|
414
417
|
};
|
415
418
|
|
416
419
|
BaseView.prototype.findEl = function(id) {
|
417
|
-
var
|
420
|
+
var base;
|
418
421
|
this.elements || (this.elements = {});
|
419
|
-
return (
|
422
|
+
return (base = this.elements)[id] || (base[id] = document.getElementById("teaspoon-" + id));
|
420
423
|
};
|
421
424
|
|
422
425
|
BaseView.prototype.setText = function(id, value) {
|
@@ -457,17 +460,17 @@
|
|
457
460
|
|
458
461
|
}).call(this);
|
459
462
|
(function() {
|
460
|
-
var
|
461
|
-
|
462
|
-
|
463
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
464
|
+
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; },
|
465
|
+
hasProp = {}.hasOwnProperty;
|
463
466
|
|
464
|
-
Teaspoon.Reporters.HTML = (function(
|
465
|
-
|
467
|
+
Teaspoon.Reporters.HTML = (function(superClass) {
|
468
|
+
extend(HTML, superClass);
|
466
469
|
|
467
470
|
function HTML() {
|
468
|
-
this.changeSuite =
|
469
|
-
this.toggleConfig =
|
470
|
-
this.reportRunnerResults =
|
471
|
+
this.changeSuite = bind(this.changeSuite, this);
|
472
|
+
this.toggleConfig = bind(this.toggleConfig, this);
|
473
|
+
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
471
474
|
this.start = new Teaspoon.Date().getTime();
|
472
475
|
this.config = {
|
473
476
|
"use-catch": true,
|
@@ -492,14 +495,14 @@
|
|
492
495
|
}
|
493
496
|
|
494
497
|
HTML.prototype.build = function() {
|
495
|
-
var
|
498
|
+
var ref;
|
496
499
|
this.buildLayout();
|
497
500
|
this.setText("env-info", this.envInfo());
|
498
501
|
this.setText("version", Teaspoon.version);
|
499
502
|
this.findEl("toggles").onclick = this.toggleConfig;
|
500
503
|
this.findEl("suites").innerHTML = this.buildSuiteSelect();
|
501
|
-
if ((
|
502
|
-
|
504
|
+
if ((ref = this.findEl("suite-select")) != null) {
|
505
|
+
ref.onchange = this.changeSuite;
|
503
506
|
}
|
504
507
|
this.el = this.findEl("report-all");
|
505
508
|
this.showConfiguration();
|
@@ -516,7 +519,7 @@
|
|
516
519
|
};
|
517
520
|
|
518
521
|
HTML.prototype.buildSuiteSelect = function() {
|
519
|
-
var filename,
|
522
|
+
var filename, i, len, options, path, ref, selected, suite;
|
520
523
|
if (Teaspoon.suites.all.length === 1) {
|
521
524
|
return "";
|
522
525
|
}
|
@@ -525,9 +528,9 @@
|
|
525
528
|
filename = "/index.html";
|
526
529
|
}
|
527
530
|
options = [];
|
528
|
-
|
529
|
-
for (
|
530
|
-
suite =
|
531
|
+
ref = Teaspoon.suites.all;
|
532
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
533
|
+
suite = ref[i];
|
531
534
|
path = [Teaspoon.root, suite].join("/");
|
532
535
|
selected = Teaspoon.suites.active === suite ? " selected" : "";
|
533
536
|
options.push("<option" + selected + " value=\"" + path + filename + "\">" + suite + "</option>");
|
@@ -587,7 +590,7 @@
|
|
587
590
|
};
|
588
591
|
|
589
592
|
HTML.prototype.elapsedTime = function() {
|
590
|
-
return
|
593
|
+
return (((new Teaspoon.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
591
594
|
};
|
592
595
|
|
593
596
|
HTML.prototype.updateStat = function(name, value) {
|
@@ -598,7 +601,7 @@
|
|
598
601
|
};
|
599
602
|
|
600
603
|
HTML.prototype.updateStatus = function(spec) {
|
601
|
-
var elapsed,
|
604
|
+
var elapsed, ref, ref1, result;
|
602
605
|
spec = new Teaspoon.Spec(spec);
|
603
606
|
result = spec.result();
|
604
607
|
if (result.skipped || result.status === "pending") {
|
@@ -608,11 +611,11 @@
|
|
608
611
|
elapsed = new Teaspoon.Date().getTime() - this.specStart;
|
609
612
|
if (result.status === "passed") {
|
610
613
|
this.updateStat("passes", this.total.passes += 1);
|
611
|
-
return (
|
614
|
+
return (ref = this.reportView) != null ? ref.updateState("passed", elapsed) : void 0;
|
612
615
|
} else {
|
613
616
|
this.updateStat("failures", this.total.failures += 1);
|
614
|
-
if ((
|
615
|
-
|
617
|
+
if ((ref1 = this.reportView) != null) {
|
618
|
+
ref1.updateState("failed", elapsed);
|
616
619
|
}
|
617
620
|
if (!this.config["build-full-report"]) {
|
618
621
|
new Teaspoon.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
@@ -626,14 +629,14 @@
|
|
626
629
|
};
|
627
630
|
|
628
631
|
HTML.prototype.showConfiguration = function() {
|
629
|
-
var key,
|
630
|
-
|
631
|
-
|
632
|
-
for (key in
|
633
|
-
value =
|
634
|
-
|
632
|
+
var key, ref, results, value;
|
633
|
+
ref = this.config;
|
634
|
+
results = [];
|
635
|
+
for (key in ref) {
|
636
|
+
value = ref[key];
|
637
|
+
results.push(this.setClass(key, value ? "active" : ""));
|
635
638
|
}
|
636
|
-
return
|
639
|
+
return results;
|
637
640
|
};
|
638
641
|
|
639
642
|
HTML.prototype.setStatus = function(status) {
|
@@ -675,8 +678,8 @@
|
|
675
678
|
};
|
676
679
|
|
677
680
|
HTML.prototype.store = function(name, value) {
|
678
|
-
var
|
679
|
-
if (((
|
681
|
+
var ref;
|
682
|
+
if (((ref = window.localStorage) != null ? ref.setItem : void 0) != null) {
|
680
683
|
return this.localstore(name, value);
|
681
684
|
} else {
|
682
685
|
return this.cookie(name, value);
|
@@ -695,7 +698,7 @@
|
|
695
698
|
} else {
|
696
699
|
date = new Teaspoon.Date();
|
697
700
|
date.setDate(date.getDate() + 365);
|
698
|
-
return document.cookie =
|
701
|
+
return document.cookie = name + "=" + (escape(JSON.stringify(value))) + "; expires=" + (date.toUTCString()) + "; path=/;";
|
699
702
|
}
|
700
703
|
};
|
701
704
|
|
@@ -716,16 +719,14 @@
|
|
716
719
|
|
717
720
|
}).call(this);
|
718
721
|
(function() {
|
719
|
-
var
|
720
|
-
|
721
|
-
__extends = 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; };
|
722
|
+
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; },
|
723
|
+
hasProp = {}.hasOwnProperty;
|
722
724
|
|
723
|
-
Teaspoon.Reporters.HTML.ProgressView = (function(
|
724
|
-
|
725
|
+
Teaspoon.Reporters.HTML.ProgressView = (function(superClass) {
|
726
|
+
extend(ProgressView, superClass);
|
725
727
|
|
726
728
|
function ProgressView() {
|
727
|
-
|
728
|
-
return _ref;
|
729
|
+
return ProgressView.__super__.constructor.apply(this, arguments);
|
729
730
|
}
|
730
731
|
|
731
732
|
ProgressView.create = function(displayProgress) {
|
@@ -752,12 +753,11 @@
|
|
752
753
|
|
753
754
|
})(Teaspoon.Reporters.BaseView);
|
754
755
|
|
755
|
-
Teaspoon.Reporters.HTML.SimpleProgressView = (function(
|
756
|
-
|
756
|
+
Teaspoon.Reporters.HTML.SimpleProgressView = (function(superClass) {
|
757
|
+
extend(SimpleProgressView, superClass);
|
757
758
|
|
758
759
|
function SimpleProgressView() {
|
759
|
-
|
760
|
-
return _ref1;
|
760
|
+
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
761
761
|
}
|
762
762
|
|
763
763
|
SimpleProgressView.prototype.build = function() {
|
@@ -768,19 +768,18 @@
|
|
768
768
|
SimpleProgressView.prototype.update = function(total, run) {
|
769
769
|
var percent;
|
770
770
|
percent = total ? Math.ceil((run * 100) / total) : 0;
|
771
|
-
return this.setHtml("progress-percent",
|
771
|
+
return this.setHtml("progress-percent", percent + "%");
|
772
772
|
};
|
773
773
|
|
774
774
|
return SimpleProgressView;
|
775
775
|
|
776
776
|
})(Teaspoon.Reporters.HTML.ProgressView);
|
777
777
|
|
778
|
-
Teaspoon.Reporters.HTML.RadialProgressView = (function(
|
779
|
-
|
778
|
+
Teaspoon.Reporters.HTML.RadialProgressView = (function(superClass) {
|
779
|
+
extend(RadialProgressView, superClass);
|
780
780
|
|
781
781
|
function RadialProgressView() {
|
782
|
-
|
783
|
-
return _ref2;
|
782
|
+
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
784
783
|
}
|
785
784
|
|
786
785
|
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
@@ -808,7 +807,7 @@
|
|
808
807
|
RadialProgressView.prototype.update = function(total, run) {
|
809
808
|
var half, percent;
|
810
809
|
percent = total ? Math.ceil((run * 100) / total) : 0;
|
811
|
-
this.setHtml("progress-percent",
|
810
|
+
this.setHtml("progress-percent", percent + "%");
|
812
811
|
if (!this.ctx) {
|
813
812
|
return;
|
814
813
|
}
|
@@ -825,13 +824,13 @@
|
|
825
824
|
|
826
825
|
}).call(this);
|
827
826
|
(function() {
|
828
|
-
var
|
829
|
-
|
827
|
+
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; },
|
828
|
+
hasProp = {}.hasOwnProperty;
|
830
829
|
|
831
|
-
Teaspoon.Reporters.HTML.SpecView = (function(
|
830
|
+
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
832
831
|
var viewId;
|
833
832
|
|
834
|
-
|
833
|
+
extend(SpecView, superClass);
|
835
834
|
|
836
835
|
viewId = 0;
|
837
836
|
|
@@ -868,12 +867,12 @@
|
|
868
867
|
};
|
869
868
|
|
870
869
|
SpecView.prototype.buildErrors = function() {
|
871
|
-
var div, error, html,
|
870
|
+
var div, error, html, i, len, ref;
|
872
871
|
div = this.createEl("div");
|
873
872
|
html = "";
|
874
|
-
|
875
|
-
for (
|
876
|
-
error =
|
873
|
+
ref = this.spec.errors();
|
874
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
875
|
+
error = ref[i];
|
877
876
|
html += "<strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable"));
|
878
877
|
}
|
879
878
|
div.innerHTML = html;
|
@@ -881,7 +880,7 @@
|
|
881
880
|
};
|
882
881
|
|
883
882
|
SpecView.prototype.updateState = function(state, elapsed) {
|
884
|
-
var classes, result
|
883
|
+
var base, classes, result;
|
885
884
|
result = this.spec.result();
|
886
885
|
classes = ["state-" + state];
|
887
886
|
if (elapsed > Teaspoon.slow) {
|
@@ -894,7 +893,7 @@
|
|
894
893
|
if (result.status !== "passed") {
|
895
894
|
this.buildErrors();
|
896
895
|
}
|
897
|
-
return typeof (
|
896
|
+
return typeof (base = this.parentView).updateState === "function" ? base.updateState(state) : void 0;
|
898
897
|
};
|
899
898
|
|
900
899
|
return SpecView;
|
@@ -903,11 +902,11 @@
|
|
903
902
|
|
904
903
|
}).call(this);
|
905
904
|
(function() {
|
906
|
-
var
|
907
|
-
|
905
|
+
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; },
|
906
|
+
hasProp = {}.hasOwnProperty;
|
908
907
|
|
909
|
-
Teaspoon.Reporters.HTML.FailureView = (function(
|
910
|
-
|
908
|
+
Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
|
909
|
+
extend(FailureView, superClass);
|
911
910
|
|
912
911
|
function FailureView(spec) {
|
913
912
|
this.spec = spec;
|
@@ -915,12 +914,12 @@
|
|
915
914
|
}
|
916
915
|
|
917
916
|
FailureView.prototype.build = function() {
|
918
|
-
var error, html,
|
917
|
+
var error, html, i, len, ref;
|
919
918
|
FailureView.__super__.build.call(this, "spec");
|
920
919
|
html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
|
921
|
-
|
922
|
-
for (
|
923
|
-
error =
|
920
|
+
ref = this.spec.errors();
|
921
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
922
|
+
error = ref[i];
|
924
923
|
html += "<div><strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
925
924
|
}
|
926
925
|
return this.el.innerHTML = html;
|
@@ -932,18 +931,18 @@
|
|
932
931
|
|
933
932
|
}).call(this);
|
934
933
|
(function() {
|
935
|
-
var
|
936
|
-
|
934
|
+
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; },
|
935
|
+
hasProp = {}.hasOwnProperty;
|
937
936
|
|
938
|
-
Teaspoon.Reporters.HTML.SuiteView = (function(
|
937
|
+
Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
|
939
938
|
var viewId;
|
940
939
|
|
941
|
-
|
940
|
+
extend(SuiteView, superClass);
|
942
941
|
|
943
942
|
viewId = 0;
|
944
943
|
|
945
|
-
function SuiteView(
|
946
|
-
this.suite =
|
944
|
+
function SuiteView(suite1, reporter) {
|
945
|
+
this.suite = suite1;
|
947
946
|
this.reporter = reporter;
|
948
947
|
this.views = this.reporter.views;
|
949
948
|
this.suite.viewId = viewId += 1;
|
@@ -981,13 +980,13 @@
|
|
981
980
|
};
|
982
981
|
|
983
982
|
SuiteView.prototype.updateState = function(state) {
|
984
|
-
var
|
983
|
+
var base;
|
985
984
|
if (this.state === "failed") {
|
986
985
|
return;
|
987
986
|
}
|
988
|
-
this.el.className =
|
989
|
-
if (typeof (
|
990
|
-
|
987
|
+
this.el.className = (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
988
|
+
if (typeof (base = this.parentView).updateState === "function") {
|
989
|
+
base.updateState(state);
|
991
990
|
}
|
992
991
|
return this.state = state;
|
993
992
|
};
|
@@ -1004,11 +1003,11 @@
|
|
1004
1003
|
|
1005
1004
|
}).call(this);
|
1006
1005
|
(function() {
|
1007
|
-
var
|
1006
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
1008
1007
|
|
1009
1008
|
Teaspoon.Reporters.Console = (function() {
|
1010
1009
|
function Console() {
|
1011
|
-
this.reportRunnerResults =
|
1010
|
+
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
1012
1011
|
this.start = new Teaspoon.Date();
|
1013
1012
|
this.suites = {};
|
1014
1013
|
}
|
@@ -1022,22 +1021,22 @@
|
|
1022
1021
|
};
|
1023
1022
|
|
1024
1023
|
Console.prototype.reportSuites = function() {
|
1025
|
-
var
|
1026
|
-
|
1027
|
-
|
1028
|
-
for (index =
|
1029
|
-
suite =
|
1024
|
+
var i, index, len, ref, results, suite;
|
1025
|
+
ref = this.spec.getParents();
|
1026
|
+
results = [];
|
1027
|
+
for (index = i = 0, len = ref.length; i < len; index = ++i) {
|
1028
|
+
suite = ref[index];
|
1030
1029
|
if (this.suites[suite.fullDescription]) {
|
1031
1030
|
continue;
|
1032
1031
|
}
|
1033
1032
|
this.suites[suite.fullDescription] = true;
|
1034
|
-
|
1033
|
+
results.push(this.log({
|
1035
1034
|
type: "suite",
|
1036
1035
|
label: suite.description,
|
1037
1036
|
level: index
|
1038
1037
|
}));
|
1039
1038
|
}
|
1040
|
-
return
|
1039
|
+
return results;
|
1041
1040
|
};
|
1042
1041
|
|
1043
1042
|
Console.prototype.reportSpecResults = function(spec) {
|
@@ -1077,13 +1076,13 @@
|
|
1077
1076
|
};
|
1078
1077
|
|
1079
1078
|
Console.prototype.trackFailure = function() {
|
1080
|
-
var error,
|
1079
|
+
var error, i, len, ref, result, results;
|
1081
1080
|
result = this.spec.result();
|
1082
|
-
|
1083
|
-
|
1084
|
-
for (
|
1085
|
-
error =
|
1086
|
-
|
1081
|
+
ref = this.spec.errors();
|
1082
|
+
results = [];
|
1083
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
1084
|
+
error = ref[i];
|
1085
|
+
results.push(this.log({
|
1087
1086
|
type: "spec",
|
1088
1087
|
suite: this.spec.suiteName,
|
1089
1088
|
label: this.spec.description,
|
@@ -1094,7 +1093,7 @@
|
|
1094
1093
|
trace: error.stack || error.message || "Stack Trace Unavailable"
|
1095
1094
|
}));
|
1096
1095
|
}
|
1097
|
-
return
|
1096
|
+
return results;
|
1098
1097
|
};
|
1099
1098
|
|
1100
1099
|
Console.prototype.reportRunnerResults = function() {
|
@@ -1120,15 +1119,15 @@
|
|
1120
1119
|
|
1121
1120
|
}).call(this);
|
1122
1121
|
(function() {
|
1123
|
-
var
|
1124
|
-
|
1125
|
-
|
1122
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1123
|
+
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; },
|
1124
|
+
hasProp = {}.hasOwnProperty;
|
1126
1125
|
|
1127
|
-
Teaspoon.Reporters.Console = (function(
|
1128
|
-
|
1126
|
+
Teaspoon.Reporters.Console = (function(superClass) {
|
1127
|
+
extend(Console, superClass);
|
1129
1128
|
|
1130
1129
|
function Console(runner) {
|
1131
|
-
this.reportSpecResults =
|
1130
|
+
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1132
1131
|
Console.__super__.constructor.apply(this, arguments);
|
1133
1132
|
this.reportRunnerStarting(runner);
|
1134
1133
|
runner.on("fail", this.reportSpecResults);
|
@@ -1153,16 +1152,15 @@
|
|
1153
1152
|
|
1154
1153
|
}).call(this);
|
1155
1154
|
(function() {
|
1156
|
-
var
|
1157
|
-
|
1158
|
-
|
1159
|
-
__extends = 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; };
|
1155
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1156
|
+
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; },
|
1157
|
+
hasProp = {}.hasOwnProperty;
|
1160
1158
|
|
1161
|
-
Teaspoon.Reporters.HTML = (function(
|
1162
|
-
|
1159
|
+
Teaspoon.Reporters.HTML = (function(superClass) {
|
1160
|
+
extend(HTML, superClass);
|
1163
1161
|
|
1164
1162
|
function HTML(runner) {
|
1165
|
-
this.reportSpecResults =
|
1163
|
+
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1166
1164
|
HTML.__super__.constructor.apply(this, arguments);
|
1167
1165
|
this.reportRunnerStarting(runner);
|
1168
1166
|
runner.on("fail", this.reportSpecResults);
|
@@ -1190,12 +1188,11 @@
|
|
1190
1188
|
|
1191
1189
|
})(Teaspoon.Reporters.HTML);
|
1192
1190
|
|
1193
|
-
Teaspoon.Reporters.HTML.SpecView = (function(
|
1194
|
-
|
1191
|
+
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
1192
|
+
extend(SpecView, superClass);
|
1195
1193
|
|
1196
1194
|
function SpecView() {
|
1197
|
-
|
1198
|
-
return _ref;
|
1195
|
+
return SpecView.__super__.constructor.apply(this, arguments);
|
1199
1196
|
}
|
1200
1197
|
|
1201
1198
|
SpecView.prototype.updateState = function(state) {
|
@@ -1208,16 +1205,16 @@
|
|
1208
1205
|
|
1209
1206
|
}).call(this);
|
1210
1207
|
(function() {
|
1211
|
-
var env,
|
1212
|
-
|
1213
|
-
|
1208
|
+
var env,
|
1209
|
+
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; },
|
1210
|
+
hasProp = {}.hasOwnProperty;
|
1214
1211
|
|
1215
1212
|
if (typeof mocha === "undefined" || mocha === null) {
|
1216
1213
|
throw new Teaspoon.Error('Mocha not found -- use `suite.use_framework :mocha` and adjust or remove the `suite.javascripts` directive.');
|
1217
1214
|
}
|
1218
1215
|
|
1219
|
-
Teaspoon.Runner = (function(
|
1220
|
-
|
1216
|
+
Teaspoon.Runner = (function(superClass) {
|
1217
|
+
extend(Runner, superClass);
|
1221
1218
|
|
1222
1219
|
function Runner() {
|
1223
1220
|
Runner.__super__.constructor.apply(this, arguments);
|
@@ -1295,12 +1292,12 @@
|
|
1295
1292
|
|
1296
1293
|
Teaspoon.Suite = (function() {
|
1297
1294
|
function Suite(suite) {
|
1298
|
-
var
|
1295
|
+
var ref;
|
1299
1296
|
this.suite = suite;
|
1300
1297
|
this.fullDescription = this.suite.fullTitle();
|
1301
1298
|
this.description = this.suite.title;
|
1302
1299
|
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
1303
|
-
this.parent = ((
|
1300
|
+
this.parent = ((ref = this.suite.parent) != null ? ref.root : void 0) ? null : this.suite.parent;
|
1304
1301
|
this.viewId = this.suite.viewId;
|
1305
1302
|
}
|
1306
1303
|
|
@@ -1308,39 +1305,40 @@
|
|
1308
1305
|
|
1309
1306
|
})();
|
1310
1307
|
|
1311
|
-
Teaspoon.fixture = (function(
|
1312
|
-
|
1308
|
+
Teaspoon.fixture = (function(superClass) {
|
1309
|
+
extend(fixture, superClass);
|
1313
1310
|
|
1314
1311
|
function fixture() {
|
1315
|
-
|
1316
|
-
return _ref;
|
1312
|
+
return fixture.__super__.constructor.apply(this, arguments);
|
1317
1313
|
}
|
1318
1314
|
|
1319
1315
|
window.fixture = fixture;
|
1320
1316
|
|
1321
1317
|
fixture.load = function() {
|
1322
|
-
var args
|
1323
|
-
_this = this;
|
1318
|
+
var args;
|
1324
1319
|
args = arguments;
|
1325
1320
|
if (env.started) {
|
1326
1321
|
return fixture.__super__.constructor.load.apply(this, arguments);
|
1327
1322
|
} else {
|
1328
|
-
return beforeEach(function() {
|
1329
|
-
return
|
1330
|
-
|
1323
|
+
return beforeEach((function(_this) {
|
1324
|
+
return function() {
|
1325
|
+
return fixture.__super__.constructor.load.apply(_this, args);
|
1326
|
+
};
|
1327
|
+
})(this));
|
1331
1328
|
}
|
1332
1329
|
};
|
1333
1330
|
|
1334
1331
|
fixture.set = function() {
|
1335
|
-
var args
|
1336
|
-
_this = this;
|
1332
|
+
var args;
|
1337
1333
|
args = arguments;
|
1338
1334
|
if (env.started) {
|
1339
1335
|
return fixture.__super__.constructor.set.apply(this, arguments);
|
1340
1336
|
} else {
|
1341
|
-
return beforeEach(function() {
|
1342
|
-
return
|
1343
|
-
|
1337
|
+
return beforeEach((function(_this) {
|
1338
|
+
return function() {
|
1339
|
+
return fixture.__super__.constructor.set.apply(_this, args);
|
1340
|
+
};
|
1341
|
+
})(this));
|
1344
1342
|
}
|
1345
1343
|
};
|
1346
1344
|
|