teaspoon 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +141 -0
- data/README.md +9 -19
- data/{vendor → app}/assets/javascripts/support/bind-poly.js +0 -0
- data/{vendor → app}/assets/javascripts/support/sinon.js +0 -0
- data/app/assets/javascripts/teaspoon-filterer.js +55 -0
- data/app/assets/javascripts/teaspoon/error.coffee +5 -0
- data/app/assets/javascripts/teaspoon/{base/fixture.coffee → fixture.coffee} +15 -15
- data/app/assets/javascripts/teaspoon/{base/hook.coffee → hook.coffee} +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/console.coffee +18 -10
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html.coffee +43 -40
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/base_view.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/failure_view.coffee +2 -0
- data/app/assets/javascripts/teaspoon/reporters/html/progress_view.coffee +18 -0
- data/app/assets/javascripts/teaspoon/{base/reporters/html/progress_view.coffee → reporters/html/radial_progress_view.coffee} +1 -34
- data/app/assets/javascripts/teaspoon/reporters/html/simple_progress_view.coffee +15 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/spec_view.coffee +5 -3
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/suite_view.coffee +4 -2
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/template.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/runner.coffee → runner.coffee} +7 -3
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +90 -32
- data/app/controllers/teaspoon/suite_controller.rb +5 -0
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +67 -37
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +14 -0
- data/lib/generators/teaspoon/install/{POST_INSTALL → templates/POST_INSTALL} +0 -0
- data/lib/generators/teaspoon/install/templates/env.rb.tt +14 -0
- data/lib/generators/teaspoon/install/templates/{jasmine/env_comments.rb.tt → env_comments.rb.tt} +34 -43
- data/lib/tasks/teaspoon/info.rake +17 -0
- data/lib/teaspoon-devkit.rb +61 -0
- data/lib/teaspoon.rb +2 -0
- data/lib/teaspoon/command_line.rb +19 -14
- data/lib/teaspoon/configuration.rb +24 -35
- data/lib/teaspoon/console.rb +11 -21
- data/lib/teaspoon/coverage.rb +14 -7
- data/lib/teaspoon/deprecated.rb +22 -4
- data/lib/teaspoon/driver.rb +15 -0
- data/lib/teaspoon/driver/base.rb +7 -0
- data/lib/teaspoon/{drivers/capybara_webkit_driver.rb → driver/capybara_webkit.rb} +8 -5
- data/lib/teaspoon/{drivers/phantomjs_driver.rb → driver/phantomjs.rb} +8 -4
- data/lib/teaspoon/{drivers → driver}/phantomjs/runner.js +0 -0
- data/lib/teaspoon/{drivers/selenium_driver.rb → driver/selenium.rb} +11 -9
- data/lib/teaspoon/engine.rb +38 -25
- data/lib/teaspoon/environment.rb +24 -15
- data/lib/teaspoon/exceptions.rb +154 -41
- data/lib/teaspoon/exporter.rb +2 -2
- data/lib/teaspoon/formatter.rb +30 -0
- data/lib/teaspoon/{formatters → formatter}/base.rb +2 -36
- data/lib/teaspoon/{formatters/clean_formatter.rb → formatter/clean.rb} +4 -2
- data/lib/teaspoon/{formatters/documentation_formatter.rb → formatter/documentation.rb} +4 -3
- data/lib/teaspoon/{formatters/dot_formatter.rb → formatter/dot.rb} +4 -3
- data/lib/teaspoon/{formatters/json_formatter.rb → formatter/json.rb} +4 -2
- data/lib/teaspoon/{formatters/junit_formatter.rb → formatter/junit.rb} +3 -2
- data/lib/teaspoon/{formatters → formatter}/modules/report_module.rb +1 -1
- data/lib/teaspoon/{formatters/pride_formatter.rb → formatter/pride.rb} +4 -2
- data/lib/teaspoon/{formatters/rspec_html_formatter.rb → formatter/rspec_html.rb} +3 -2
- data/lib/teaspoon/{formatters/snowday_formatter.rb → formatter/snowday.rb} +3 -2
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +111 -0
- data/lib/teaspoon/{formatters/tap_formatter.rb → formatter/tap.rb} +4 -2
- data/lib/teaspoon/{formatters/tap_y_formatter.rb → formatter/tap_y.rb} +3 -2
- data/lib/teaspoon/{formatters/teamcity_formatter.rb → formatter/teamcity.rb} +4 -2
- data/lib/teaspoon/framework.rb +17 -0
- data/lib/teaspoon/framework/base.rb +88 -0
- data/lib/teaspoon/instrumentation.rb +12 -2
- data/lib/teaspoon/registry.rb +47 -0
- data/lib/teaspoon/registry/has_default.rb +11 -0
- data/lib/teaspoon/runner.rb +6 -7
- data/lib/teaspoon/server.rb +2 -2
- data/lib/teaspoon/suite.rb +28 -30
- data/lib/teaspoon/utility.rb +5 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +52 -276
- data/app/assets/javascripts/teaspoon-jasmine.js +0 -1344
- data/app/assets/javascripts/teaspoon-mocha.js +0 -1350
- data/app/assets/javascripts/teaspoon-qunit.js +0 -1415
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -51
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +0 -69
- data/app/assets/javascripts/teaspoon/jasmine.coffee +0 -119
- data/app/assets/javascripts/teaspoon/jasmine/reporters/html.coffee +0 -11
- data/app/assets/javascripts/teaspoon/mocha.coffee +0 -90
- data/app/assets/javascripts/teaspoon/mocha/reporters/console.coffee +0 -16
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +0 -27
- data/app/assets/javascripts/teaspoon/qunit.coffee +0 -81
- data/app/assets/javascripts/teaspoon/qunit/reporters/console.coffee +0 -25
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +0 -80
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +0 -31
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +0 -31
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +0 -40
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +0 -40
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +0 -29
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +0 -30
- data/lib/teaspoon/drivers/base.rb +0 -10
- data/lib/teaspoon/formatters/description.rb +0 -36
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +0 -101
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/instrumented1.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/instrumented2.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +0 -32
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +0 -7
- data/spec/dummy/app/assets/javascripts/specs/asset_spec.js +0 -11
- data/spec/dummy/config.ru +0 -15
- data/spec/dummy/config/application.rb +0 -29
- data/spec/dummy/config/boot.rb +0 -3
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/routes.rb +0 -2
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/features/console_reporter_spec.rb +0 -62
- data/spec/features/hooks_spec.rb +0 -60
- data/spec/features/html_reporter_spec.rb +0 -81
- data/spec/features/install_generator_spec.rb +0 -54
- data/spec/features/instrumentation_spec.rb +0 -21
- data/spec/fixtures/coverage.json +0 -243
- data/spec/javascripts/fixtures/_body.html.erb +0 -1
- data/spec/javascripts/fixtures/fixture.html.haml +0 -4
- data/spec/javascripts/fixtures/fixture.json +0 -4
- data/spec/javascripts/jasmine_helper.coffee +0 -3
- data/spec/javascripts/mocha_helper.coffee +0 -4
- data/spec/javascripts/spec_helper.coffee +0 -7
- data/spec/javascripts/stylesheets/stylesheet.css.scss +0 -0
- data/spec/javascripts/support/json2.js +0 -486
- data/spec/javascripts/support/support.js.coffee +0 -0
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +0 -93
- data/spec/javascripts/teaspoon/base/reporters/console_spec.coffee +0 -162
- data/spec/javascripts/teaspoon/base/reporters/html/base_view_spec.coffee +0 -88
- data/spec/javascripts/teaspoon/base/reporters/html/failure_view_spec.coffee +0 -28
- data/spec/javascripts/teaspoon/base/reporters/html/progress_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/spec_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/suite_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +0 -372
- data/spec/javascripts/teaspoon/base/runner_spec.coffee +0 -58
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +0 -47
- data/spec/javascripts/teaspoon/jasmine/fixture_jspec.coffee +0 -13
- data/spec/javascripts/teaspoon/jasmine/models_jspec.coffee +0 -101
- data/spec/javascripts/teaspoon/jasmine/reporters/html_jspec.coffee +0 -17
- data/spec/javascripts/teaspoon/jasmine/runner_jspec.coffee +0 -59
- data/spec/javascripts/teaspoon/jasmine/spec_jspec.coffee +0 -3
- data/spec/javascripts/teaspoon/mocha/fixture_mspec.coffee +0 -12
- data/spec/javascripts/teaspoon/mocha/models_mspec.coffee +0 -93
- data/spec/javascripts/teaspoon/mocha/reporters/console_mspec.coffee +0 -24
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -41
- data/spec/javascripts/teaspoon/mocha/runner_mspec.coffee +0 -23
- data/spec/javascripts/teaspoon/mocha/spec_mspec.coffee +0 -9
- data/spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb +0 -4
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +0 -161
- data/spec/javascripts/turbolinks_helper.coffee +0 -2
- data/spec/spec_helper.rb +0 -25
- data/spec/support/aruba.rb +0 -15
- data/spec/teaspoon/command_line_spec.rb +0 -157
- data/spec/teaspoon/configuration_spec.rb +0 -236
- data/spec/teaspoon/console_spec.rb +0 -224
- data/spec/teaspoon/coverage_spec.rb +0 -118
- data/spec/teaspoon/drivers/base_spec.rb +0 -5
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +0 -39
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +0 -66
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +0 -68
- data/spec/teaspoon/engine_spec.rb +0 -22
- data/spec/teaspoon/environment_spec.rb +0 -109
- data/spec/teaspoon/exceptions_spec.rb +0 -57
- data/spec/teaspoon/exporter_spec.rb +0 -96
- data/spec/teaspoon/formatters/base_spec.rb +0 -259
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +0 -127
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +0 -116
- data/spec/teaspoon/formatters/json_formatter_spec.rb +0 -77
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +0 -114
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +0 -107
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +0 -35
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +0 -72
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +0 -80
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +0 -148
- data/spec/teaspoon/instrumentation_spec.rb +0 -113
- data/spec/teaspoon/result_spec.rb +0 -98
- data/spec/teaspoon/runner_spec.rb +0 -116
- data/spec/teaspoon/server_spec.rb +0 -105
- data/spec/teaspoon/suite_spec.rb +0 -138
- data/spec/teaspoon_env.rb +0 -39
- data/test/javascripts/qunit_helper.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/fixture_test.coffee +0 -10
- data/test/javascripts/teaspoon/qunit/models_test.coffee +0 -66
- data/test/javascripts/teaspoon/qunit/reporters/console_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/failure_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/spec_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/suite_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/runner_test.coffee +0 -18
- data/vendor/assets/javascripts/jasmine/1.3.1.js +0 -2602
- data/vendor/assets/javascripts/jasmine/2.0.0.js +0 -2412
- data/vendor/assets/javascripts/jasmine/MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/mocha/1.10.0.js +0 -5374
- data/vendor/assets/javascripts/mocha/1.17.1.js +0 -5813
- data/vendor/assets/javascripts/mocha/MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/qunit/1.12.0.js +0 -2212
- data/vendor/assets/javascripts/qunit/1.14.0.js +0 -2288
- data/vendor/assets/javascripts/qunit/MIT.LICENSE +0 -21
- data/vendor/assets/javascripts/support/chai-1.10.0.js +0 -4800
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +0 -524
- data/vendor/assets/javascripts/support/chai.js +0 -4782
- data/vendor/assets/javascripts/support/expect.js +0 -1284
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +0 -720
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +0 -812
- data/vendor/assets/javascripts/support/sinon-chai.js +0 -126
@@ -1,1415 +0,0 @@
|
|
1
|
-
(function() {
|
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
|
-
|
5
|
-
this.Teaspoon = (function() {
|
6
|
-
function Teaspoon() {}
|
7
|
-
|
8
|
-
Teaspoon.defer = false;
|
9
|
-
|
10
|
-
Teaspoon.slow = 75;
|
11
|
-
|
12
|
-
Teaspoon.root = window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "");
|
13
|
-
|
14
|
-
Teaspoon.started = false;
|
15
|
-
|
16
|
-
Teaspoon.finished = false;
|
17
|
-
|
18
|
-
Teaspoon.Reporters = {};
|
19
|
-
|
20
|
-
Teaspoon.Date = Date;
|
21
|
-
|
22
|
-
Teaspoon.location = window.location;
|
23
|
-
|
24
|
-
Teaspoon.messages = [];
|
25
|
-
|
26
|
-
Teaspoon.execute = function() {
|
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.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, i, j, 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 (i = 0, len = paths.length; i < len; i++) {
|
63
|
-
path = paths[i];
|
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 (j = 0, len1 = all.length; j < len1; j++) {
|
70
|
-
dep = all[j];
|
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
|
-
return Teaspoon;
|
98
|
-
|
99
|
-
})();
|
100
|
-
|
101
|
-
Teaspoon.Error = (function(superClass) {
|
102
|
-
extend(Error, superClass);
|
103
|
-
|
104
|
-
function Error(message) {
|
105
|
-
this.name = "TeaspoonError";
|
106
|
-
this.message = message || "";
|
107
|
-
}
|
108
|
-
|
109
|
-
return Error;
|
110
|
-
|
111
|
-
})(Error);
|
112
|
-
|
113
|
-
}).call(this);
|
114
|
-
(function() {
|
115
|
-
Teaspoon.Runner = (function() {
|
116
|
-
Runner.run = false;
|
117
|
-
|
118
|
-
function Runner() {
|
119
|
-
if (this.constructor.run) {
|
120
|
-
return;
|
121
|
-
}
|
122
|
-
this.constructor.run = true;
|
123
|
-
this.fixturePath = Teaspoon.root + "/fixtures";
|
124
|
-
this.params = Teaspoon.params = this.getParams();
|
125
|
-
this.setup();
|
126
|
-
}
|
127
|
-
|
128
|
-
Runner.prototype.getParams = function() {
|
129
|
-
var i, len, name, param, params, ref, ref1, value;
|
130
|
-
params = {};
|
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
|
-
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
136
|
-
}
|
137
|
-
return params;
|
138
|
-
};
|
139
|
-
|
140
|
-
Runner.prototype.getReporter = function() {
|
141
|
-
if (this.params["reporter"]) {
|
142
|
-
return Teaspoon.Reporters[this.params["reporter"]];
|
143
|
-
} else {
|
144
|
-
if (window.navigator.userAgent.match(/PhantomJS/)) {
|
145
|
-
return Teaspoon.Reporters.Console;
|
146
|
-
} else {
|
147
|
-
return Teaspoon.Reporters.HTML;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
};
|
151
|
-
|
152
|
-
Runner.prototype.setup = function() {};
|
153
|
-
|
154
|
-
return Runner;
|
155
|
-
|
156
|
-
})();
|
157
|
-
|
158
|
-
}).call(this);
|
159
|
-
(function() {
|
160
|
-
var slice = [].slice;
|
161
|
-
|
162
|
-
Teaspoon.fixture = (function() {
|
163
|
-
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
164
|
-
|
165
|
-
fixture.cache = {};
|
166
|
-
|
167
|
-
fixture.el = null;
|
168
|
-
|
169
|
-
fixture.$el = null;
|
170
|
-
|
171
|
-
fixture.json = [];
|
172
|
-
|
173
|
-
fixture.preload = function() {
|
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));
|
180
|
-
}
|
181
|
-
return results;
|
182
|
-
};
|
183
|
-
|
184
|
-
fixture.load = function() {
|
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++];
|
187
|
-
if (append == null) {
|
188
|
-
append = false;
|
189
|
-
}
|
190
|
-
if (typeof append !== "boolean") {
|
191
|
-
urls.push(append);
|
192
|
-
append = false;
|
193
|
-
}
|
194
|
-
results = [];
|
195
|
-
for (index = j = 0, len = urls.length; j < len; index = ++j) {
|
196
|
-
url = urls[index];
|
197
|
-
results.push(load(url, append || index > 0));
|
198
|
-
}
|
199
|
-
return results;
|
200
|
-
};
|
201
|
-
|
202
|
-
fixture.set = function() {
|
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++];
|
205
|
-
if (append == null) {
|
206
|
-
append = false;
|
207
|
-
}
|
208
|
-
if (typeof append !== "boolean") {
|
209
|
-
htmls.push(append);
|
210
|
-
append = false;
|
211
|
-
}
|
212
|
-
results = [];
|
213
|
-
for (index = j = 0, len = htmls.length; j < len; index = ++j) {
|
214
|
-
html = htmls[index];
|
215
|
-
results.push(set(html, append || index > 0));
|
216
|
-
}
|
217
|
-
return results;
|
218
|
-
};
|
219
|
-
|
220
|
-
fixture.cleanup = function() {
|
221
|
-
return cleanup();
|
222
|
-
};
|
223
|
-
|
224
|
-
function fixture() {
|
225
|
-
Teaspoon.fixture.load.apply(window, arguments);
|
226
|
-
}
|
227
|
-
|
228
|
-
xhr = null;
|
229
|
-
|
230
|
-
preload = function(url) {
|
231
|
-
return load(url, false, true);
|
232
|
-
};
|
233
|
-
|
234
|
-
load = function(url, append, preload) {
|
235
|
-
var cached, value;
|
236
|
-
if (preload == null) {
|
237
|
-
preload = false;
|
238
|
-
}
|
239
|
-
if (cached = Teaspoon.fixture.cache[url]) {
|
240
|
-
return loadComplete(url, cached.type, cached.content, append, preload);
|
241
|
-
}
|
242
|
-
value = null;
|
243
|
-
xhrRequest(url, function() {
|
244
|
-
if (xhr.readyState !== 4) {
|
245
|
-
return;
|
246
|
-
}
|
247
|
-
if (xhr.status !== 200) {
|
248
|
-
throw "Unable to load fixture \"" + url + "\".";
|
249
|
-
}
|
250
|
-
return value = loadComplete(url, xhr.getResponseHeader("content-type"), xhr.responseText, append, preload);
|
251
|
-
});
|
252
|
-
return value;
|
253
|
-
};
|
254
|
-
|
255
|
-
loadComplete = function(url, type, content, append, preload) {
|
256
|
-
Teaspoon.fixture.cache[url] = {
|
257
|
-
type: type,
|
258
|
-
content: content
|
259
|
-
};
|
260
|
-
if (type.match(/application\/json;/)) {
|
261
|
-
return fixture.json[fixture.json.push(JSON.parse(content)) - 1];
|
262
|
-
}
|
263
|
-
if (preload) {
|
264
|
-
return content;
|
265
|
-
}
|
266
|
-
if (append) {
|
267
|
-
addContent(content);
|
268
|
-
} else {
|
269
|
-
putContent(content);
|
270
|
-
}
|
271
|
-
return Teaspoon.fixture.el;
|
272
|
-
};
|
273
|
-
|
274
|
-
set = function(content, append) {
|
275
|
-
if (append) {
|
276
|
-
return addContent(content);
|
277
|
-
} else {
|
278
|
-
return putContent(content);
|
279
|
-
}
|
280
|
-
};
|
281
|
-
|
282
|
-
putContent = function(content) {
|
283
|
-
cleanup();
|
284
|
-
create();
|
285
|
-
return Teaspoon.fixture.el.innerHTML = content;
|
286
|
-
};
|
287
|
-
|
288
|
-
addContent = function(content) {
|
289
|
-
if (!Teaspoon.fixture.el) {
|
290
|
-
create();
|
291
|
-
}
|
292
|
-
return Teaspoon.fixture.el.innerHTML += content;
|
293
|
-
};
|
294
|
-
|
295
|
-
create = function() {
|
296
|
-
var ref;
|
297
|
-
Teaspoon.fixture.el = document.createElement("div");
|
298
|
-
if (typeof window.$ === 'function') {
|
299
|
-
Teaspoon.fixture.$el = $(Teaspoon.fixture.el);
|
300
|
-
}
|
301
|
-
Teaspoon.fixture.el.id = "teaspoon-fixtures";
|
302
|
-
return (ref = document.body) != null ? ref.appendChild(Teaspoon.fixture.el) : void 0;
|
303
|
-
};
|
304
|
-
|
305
|
-
cleanup = function() {
|
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);
|
311
|
-
}
|
312
|
-
}
|
313
|
-
return Teaspoon.fixture.el = null;
|
314
|
-
};
|
315
|
-
|
316
|
-
xhrRequest = function(url, callback) {
|
317
|
-
var e;
|
318
|
-
if (window.XMLHttpRequest) {
|
319
|
-
xhr = new XMLHttpRequest();
|
320
|
-
} else if (window.ActiveXObject) {
|
321
|
-
try {
|
322
|
-
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
323
|
-
} catch (_error) {
|
324
|
-
e = _error;
|
325
|
-
try {
|
326
|
-
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
327
|
-
} catch (_error) {
|
328
|
-
e = _error;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
}
|
332
|
-
if (!xhr) {
|
333
|
-
throw "Unable to make Ajax Request";
|
334
|
-
}
|
335
|
-
xhr.onreadystatechange = callback;
|
336
|
-
xhr.open("GET", Teaspoon.root + "/fixtures/" + url, false);
|
337
|
-
return xhr.send();
|
338
|
-
};
|
339
|
-
|
340
|
-
return fixture;
|
341
|
-
|
342
|
-
})();
|
343
|
-
|
344
|
-
}).call(this);
|
345
|
-
(function() {
|
346
|
-
Teaspoon.hook = function(name, payload) {
|
347
|
-
var xhr, xhrRequest;
|
348
|
-
if (payload == null) {
|
349
|
-
payload = {};
|
350
|
-
}
|
351
|
-
xhr = null;
|
352
|
-
xhrRequest = function(url, payload, callback) {
|
353
|
-
var e;
|
354
|
-
if (window.XMLHttpRequest) {
|
355
|
-
xhr = new XMLHttpRequest();
|
356
|
-
} else if (window.ActiveXObject) {
|
357
|
-
try {
|
358
|
-
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
359
|
-
} catch (_error) {
|
360
|
-
e = _error;
|
361
|
-
try {
|
362
|
-
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
363
|
-
} catch (_error) {
|
364
|
-
e = _error;
|
365
|
-
}
|
366
|
-
}
|
367
|
-
}
|
368
|
-
if (!xhr) {
|
369
|
-
throw "Unable to make Ajax Request";
|
370
|
-
}
|
371
|
-
xhr.onreadystatechange = callback;
|
372
|
-
xhr.open("POST", Teaspoon.root + "/" + url, false);
|
373
|
-
xhr.setRequestHeader("Content-Type", "application/json");
|
374
|
-
return xhr.send(JSON.stringify({
|
375
|
-
args: payload
|
376
|
-
}));
|
377
|
-
};
|
378
|
-
return xhrRequest(Teaspoon.suites.active + "/" + name, payload, function() {
|
379
|
-
if (xhr.readyState !== 4) {
|
380
|
-
return;
|
381
|
-
}
|
382
|
-
if (xhr.status !== 200) {
|
383
|
-
throw "Unable to call hook \"" + url + "\".";
|
384
|
-
}
|
385
|
-
});
|
386
|
-
};
|
387
|
-
|
388
|
-
}).call(this);
|
389
|
-
(function() {
|
390
|
-
Teaspoon.Reporters.BaseView = (function() {
|
391
|
-
function BaseView() {
|
392
|
-
this.elements = {};
|
393
|
-
this.build();
|
394
|
-
}
|
395
|
-
|
396
|
-
BaseView.prototype.build = function(className) {
|
397
|
-
return this.el = this.createEl("li", className);
|
398
|
-
};
|
399
|
-
|
400
|
-
BaseView.prototype.appendTo = function(el) {
|
401
|
-
return el.appendChild(this.el);
|
402
|
-
};
|
403
|
-
|
404
|
-
BaseView.prototype.append = function(el) {
|
405
|
-
return this.el.appendChild(el);
|
406
|
-
};
|
407
|
-
|
408
|
-
BaseView.prototype.createEl = function(type, className) {
|
409
|
-
var el;
|
410
|
-
if (className == null) {
|
411
|
-
className = "";
|
412
|
-
}
|
413
|
-
el = document.createElement(type);
|
414
|
-
el.className = className;
|
415
|
-
return el;
|
416
|
-
};
|
417
|
-
|
418
|
-
BaseView.prototype.findEl = function(id) {
|
419
|
-
var base;
|
420
|
-
this.elements || (this.elements = {});
|
421
|
-
return (base = this.elements)[id] || (base[id] = document.getElementById("teaspoon-" + id));
|
422
|
-
};
|
423
|
-
|
424
|
-
BaseView.prototype.setText = function(id, value) {
|
425
|
-
var el;
|
426
|
-
el = this.findEl(id);
|
427
|
-
return el.innerHTML = value;
|
428
|
-
};
|
429
|
-
|
430
|
-
BaseView.prototype.setHtml = function(id, value, add) {
|
431
|
-
var el;
|
432
|
-
if (add == null) {
|
433
|
-
add = false;
|
434
|
-
}
|
435
|
-
el = this.findEl(id);
|
436
|
-
if (add) {
|
437
|
-
return el.innerHTML += value;
|
438
|
-
} else {
|
439
|
-
return el.innerHTML = value;
|
440
|
-
}
|
441
|
-
};
|
442
|
-
|
443
|
-
BaseView.prototype.setClass = function(id, value) {
|
444
|
-
var el;
|
445
|
-
el = this.findEl(id);
|
446
|
-
return el.className = value;
|
447
|
-
};
|
448
|
-
|
449
|
-
BaseView.prototype.htmlSafe = function(str) {
|
450
|
-
var el;
|
451
|
-
el = document.createElement("div");
|
452
|
-
el.appendChild(document.createTextNode(str));
|
453
|
-
return el.innerHTML;
|
454
|
-
};
|
455
|
-
|
456
|
-
return BaseView;
|
457
|
-
|
458
|
-
})();
|
459
|
-
|
460
|
-
}).call(this);
|
461
|
-
(function() {
|
462
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
463
|
-
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; },
|
464
|
-
hasProp = {}.hasOwnProperty;
|
465
|
-
|
466
|
-
Teaspoon.Reporters.HTML = (function(superClass) {
|
467
|
-
extend(HTML, superClass);
|
468
|
-
|
469
|
-
function HTML() {
|
470
|
-
this.changeSuite = bind(this.changeSuite, this);
|
471
|
-
this.toggleConfig = bind(this.toggleConfig, this);
|
472
|
-
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
473
|
-
this.start = new Teaspoon.Date().getTime();
|
474
|
-
this.config = {
|
475
|
-
"use-catch": true,
|
476
|
-
"build-full-report": false,
|
477
|
-
"display-progress": true
|
478
|
-
};
|
479
|
-
this.total = {
|
480
|
-
exist: 0,
|
481
|
-
run: 0,
|
482
|
-
passes: 0,
|
483
|
-
failures: 0,
|
484
|
-
skipped: 0
|
485
|
-
};
|
486
|
-
this.views = {
|
487
|
-
specs: {},
|
488
|
-
suites: {}
|
489
|
-
};
|
490
|
-
this.filters = [];
|
491
|
-
this.setFilters();
|
492
|
-
this.readConfig();
|
493
|
-
HTML.__super__.constructor.apply(this, arguments);
|
494
|
-
}
|
495
|
-
|
496
|
-
HTML.prototype.build = function() {
|
497
|
-
var ref;
|
498
|
-
this.buildLayout();
|
499
|
-
this.setText("env-info", this.envInfo());
|
500
|
-
this.setText("version", Teaspoon.version);
|
501
|
-
this.findEl("toggles").onclick = this.toggleConfig;
|
502
|
-
this.findEl("suites").innerHTML = this.buildSuiteSelect();
|
503
|
-
if ((ref = this.findEl("suite-select")) != null) {
|
504
|
-
ref.onchange = this.changeSuite;
|
505
|
-
}
|
506
|
-
this.el = this.findEl("report-all");
|
507
|
-
this.showConfiguration();
|
508
|
-
this.buildProgress();
|
509
|
-
return this.buildFilters();
|
510
|
-
};
|
511
|
-
|
512
|
-
HTML.prototype.buildLayout = function() {
|
513
|
-
var el;
|
514
|
-
el = this.createEl("div");
|
515
|
-
el.id = "teaspoon-interface";
|
516
|
-
el.innerHTML = Teaspoon.Reporters.HTML.template();
|
517
|
-
return document.body.appendChild(el);
|
518
|
-
};
|
519
|
-
|
520
|
-
HTML.prototype.buildSuiteSelect = function() {
|
521
|
-
var filename, i, len, options, path, ref, selected, suite;
|
522
|
-
if (Teaspoon.suites.all.length === 1) {
|
523
|
-
return "";
|
524
|
-
}
|
525
|
-
filename = "";
|
526
|
-
if (/index\.html$/.test(window.location.pathname)) {
|
527
|
-
filename = "/index.html";
|
528
|
-
}
|
529
|
-
options = [];
|
530
|
-
ref = Teaspoon.suites.all;
|
531
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
532
|
-
suite = ref[i];
|
533
|
-
path = [Teaspoon.root, suite].join("/");
|
534
|
-
selected = Teaspoon.suites.active === suite ? " selected" : "";
|
535
|
-
options.push("<option" + selected + " value=\"" + path + filename + "\">" + suite + "</option>");
|
536
|
-
}
|
537
|
-
return "<select id=\"teaspoon-suite-select\">" + (options.join("")) + "</select>";
|
538
|
-
};
|
539
|
-
|
540
|
-
HTML.prototype.buildProgress = function() {
|
541
|
-
this.progress = Teaspoon.Reporters.HTML.ProgressView.create(this.config["display-progress"]);
|
542
|
-
return this.progress.appendTo(this.findEl("progress"));
|
543
|
-
};
|
544
|
-
|
545
|
-
HTML.prototype.buildFilters = function() {
|
546
|
-
if (this.filters.length) {
|
547
|
-
this.setClass("filter", "teaspoon-filtered");
|
548
|
-
}
|
549
|
-
return this.setHtml("filter-list", "<li>" + (this.filters.join("</li><li>")), true);
|
550
|
-
};
|
551
|
-
|
552
|
-
HTML.prototype.reportRunnerStarting = function(runner) {
|
553
|
-
this.total.exist = runner.total || (typeof runner.specs === "function" ? runner.specs().length : void 0) || 0;
|
554
|
-
if (this.total.exist) {
|
555
|
-
return this.setText("stats-duration", "...");
|
556
|
-
}
|
557
|
-
};
|
558
|
-
|
559
|
-
HTML.prototype.reportSpecStarting = function(spec) {
|
560
|
-
spec = new Teaspoon.Spec(spec);
|
561
|
-
if (this.config["build-full-report"]) {
|
562
|
-
this.reportView = new Teaspoon.Reporters.HTML.SpecView(spec, this);
|
563
|
-
}
|
564
|
-
return this.specStart = new Teaspoon.Date().getTime();
|
565
|
-
};
|
566
|
-
|
567
|
-
HTML.prototype.reportSpecResults = function(spec) {
|
568
|
-
this.total.run += 1;
|
569
|
-
this.updateProgress();
|
570
|
-
return this.updateStatus(spec);
|
571
|
-
};
|
572
|
-
|
573
|
-
HTML.prototype.reportRunnerResults = function() {
|
574
|
-
if (!this.total.run) {
|
575
|
-
return;
|
576
|
-
}
|
577
|
-
this.setText("stats-duration", this.elapsedTime());
|
578
|
-
if (!this.total.failures) {
|
579
|
-
this.setStatus("passed");
|
580
|
-
}
|
581
|
-
this.setText("stats-passes", this.total.passes);
|
582
|
-
this.setText("stats-failures", this.total.failures);
|
583
|
-
if (this.total.run < this.total.exist) {
|
584
|
-
this.total.skipped = this.total.exist - this.total.run;
|
585
|
-
this.total.run = this.total.exist;
|
586
|
-
}
|
587
|
-
this.setText("stats-skipped", this.total.skipped);
|
588
|
-
return this.updateProgress();
|
589
|
-
};
|
590
|
-
|
591
|
-
HTML.prototype.elapsedTime = function() {
|
592
|
-
return (((new Teaspoon.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
593
|
-
};
|
594
|
-
|
595
|
-
HTML.prototype.updateStat = function(name, value) {
|
596
|
-
if (!this.config["display-progress"]) {
|
597
|
-
return;
|
598
|
-
}
|
599
|
-
return this.setText("stats-" + name, value);
|
600
|
-
};
|
601
|
-
|
602
|
-
HTML.prototype.updateStatus = function(spec) {
|
603
|
-
var elapsed, ref, ref1, result;
|
604
|
-
spec = new Teaspoon.Spec(spec);
|
605
|
-
result = spec.result();
|
606
|
-
if (result.skipped || result.status === "pending") {
|
607
|
-
this.updateStat("skipped", this.total.skipped += 1);
|
608
|
-
return;
|
609
|
-
}
|
610
|
-
elapsed = new Teaspoon.Date().getTime() - this.specStart;
|
611
|
-
if (result.status === "passed") {
|
612
|
-
this.updateStat("passes", this.total.passes += 1);
|
613
|
-
return (ref = this.reportView) != null ? ref.updateState("passed", elapsed) : void 0;
|
614
|
-
} else {
|
615
|
-
this.updateStat("failures", this.total.failures += 1);
|
616
|
-
if ((ref1 = this.reportView) != null) {
|
617
|
-
ref1.updateState("failed", elapsed);
|
618
|
-
}
|
619
|
-
if (!this.config["build-full-report"]) {
|
620
|
-
new Teaspoon.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
621
|
-
}
|
622
|
-
return this.setStatus("failed");
|
623
|
-
}
|
624
|
-
};
|
625
|
-
|
626
|
-
HTML.prototype.updateProgress = function() {
|
627
|
-
return this.progress.update(this.total.exist, this.total.run);
|
628
|
-
};
|
629
|
-
|
630
|
-
HTML.prototype.showConfiguration = function() {
|
631
|
-
var key, ref, results, value;
|
632
|
-
ref = this.config;
|
633
|
-
results = [];
|
634
|
-
for (key in ref) {
|
635
|
-
value = ref[key];
|
636
|
-
results.push(this.setClass(key, value ? "active" : ""));
|
637
|
-
}
|
638
|
-
return results;
|
639
|
-
};
|
640
|
-
|
641
|
-
HTML.prototype.setStatus = function(status) {
|
642
|
-
return document.body.className = "teaspoon-" + status;
|
643
|
-
};
|
644
|
-
|
645
|
-
HTML.prototype.setFilters = function() {
|
646
|
-
if (Teaspoon.params["file"]) {
|
647
|
-
this.filters.push("by file: " + Teaspoon.params["file"]);
|
648
|
-
}
|
649
|
-
if (Teaspoon.params["grep"]) {
|
650
|
-
return this.filters.push("by match: " + Teaspoon.params["grep"]);
|
651
|
-
}
|
652
|
-
};
|
653
|
-
|
654
|
-
HTML.prototype.readConfig = function() {
|
655
|
-
var config;
|
656
|
-
if (config = this.store("teaspoon")) {
|
657
|
-
return this.config = config;
|
658
|
-
}
|
659
|
-
};
|
660
|
-
|
661
|
-
HTML.prototype.toggleConfig = function(e) {
|
662
|
-
var button, name;
|
663
|
-
button = e.target;
|
664
|
-
if (button.tagName.toLowerCase() !== "button") {
|
665
|
-
return;
|
666
|
-
}
|
667
|
-
name = button.getAttribute("id").replace(/^teaspoon-/, "");
|
668
|
-
this.config[name] = !this.config[name];
|
669
|
-
this.store("teaspoon", this.config);
|
670
|
-
return Teaspoon.reload();
|
671
|
-
};
|
672
|
-
|
673
|
-
HTML.prototype.changeSuite = function(e) {
|
674
|
-
var options;
|
675
|
-
options = e.target.options;
|
676
|
-
return window.location.href = options[options.selectedIndex].value;
|
677
|
-
};
|
678
|
-
|
679
|
-
HTML.prototype.store = function(name, value) {
|
680
|
-
var ref;
|
681
|
-
if (((ref = window.localStorage) != null ? ref.setItem : void 0) != null) {
|
682
|
-
return this.localstore(name, value);
|
683
|
-
} else {
|
684
|
-
return this.cookie(name, value);
|
685
|
-
}
|
686
|
-
};
|
687
|
-
|
688
|
-
HTML.prototype.cookie = function(name, value) {
|
689
|
-
var date, match;
|
690
|
-
if (value == null) {
|
691
|
-
value = void 0;
|
692
|
-
}
|
693
|
-
if (value === void 0) {
|
694
|
-
name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
695
|
-
match = document.cookie.match(new RegExp("(?:^|;)\\s?" + name + "=(.*?)(?:;|$)", "i"));
|
696
|
-
return match && JSON.parse(unescape(match[1]).split(" ")[0]);
|
697
|
-
} else {
|
698
|
-
date = new Teaspoon.Date();
|
699
|
-
date.setDate(date.getDate() + 365);
|
700
|
-
return document.cookie = name + "=" + (escape(JSON.stringify(value))) + "; expires=" + (date.toUTCString()) + "; path=/;";
|
701
|
-
}
|
702
|
-
};
|
703
|
-
|
704
|
-
HTML.prototype.localstore = function(name, value) {
|
705
|
-
if (value == null) {
|
706
|
-
value = void 0;
|
707
|
-
}
|
708
|
-
if (value === void 0) {
|
709
|
-
return JSON.parse(unescape(localStorage.getItem(name)));
|
710
|
-
} else {
|
711
|
-
return localStorage.setItem(name, escape(JSON.stringify(value)));
|
712
|
-
}
|
713
|
-
};
|
714
|
-
|
715
|
-
return HTML;
|
716
|
-
|
717
|
-
})(Teaspoon.Reporters.BaseView);
|
718
|
-
|
719
|
-
}).call(this);
|
720
|
-
(function() {
|
721
|
-
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; },
|
722
|
-
hasProp = {}.hasOwnProperty;
|
723
|
-
|
724
|
-
Teaspoon.Reporters.HTML.ProgressView = (function(superClass) {
|
725
|
-
extend(ProgressView, superClass);
|
726
|
-
|
727
|
-
function ProgressView() {
|
728
|
-
return ProgressView.__super__.constructor.apply(this, arguments);
|
729
|
-
}
|
730
|
-
|
731
|
-
ProgressView.create = function(displayProgress) {
|
732
|
-
if (displayProgress == null) {
|
733
|
-
displayProgress = true;
|
734
|
-
}
|
735
|
-
if (!displayProgress) {
|
736
|
-
return new Teaspoon.Reporters.HTML.ProgressView();
|
737
|
-
}
|
738
|
-
if (Teaspoon.Reporters.HTML.RadialProgressView.supported) {
|
739
|
-
return new Teaspoon.Reporters.HTML.RadialProgressView();
|
740
|
-
} else {
|
741
|
-
return new Teaspoon.Reporters.HTML.SimpleProgressView();
|
742
|
-
}
|
743
|
-
};
|
744
|
-
|
745
|
-
ProgressView.prototype.build = function() {
|
746
|
-
return this.el = this.createEl("div", "teaspoon-indicator teaspoon-logo");
|
747
|
-
};
|
748
|
-
|
749
|
-
ProgressView.prototype.update = function() {};
|
750
|
-
|
751
|
-
return ProgressView;
|
752
|
-
|
753
|
-
})(Teaspoon.Reporters.BaseView);
|
754
|
-
|
755
|
-
Teaspoon.Reporters.HTML.SimpleProgressView = (function(superClass) {
|
756
|
-
extend(SimpleProgressView, superClass);
|
757
|
-
|
758
|
-
function SimpleProgressView() {
|
759
|
-
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
760
|
-
}
|
761
|
-
|
762
|
-
SimpleProgressView.prototype.build = function() {
|
763
|
-
this.el = this.createEl("div", "simple-progress");
|
764
|
-
return this.el.innerHTML = "<em id=\"teaspoon-progress-percent\">0%</em>\n<span id=\"teaspoon-progress-span\" class=\"teaspoon-indicator\"></span>";
|
765
|
-
};
|
766
|
-
|
767
|
-
SimpleProgressView.prototype.update = function(total, run) {
|
768
|
-
var percent;
|
769
|
-
percent = total ? Math.ceil((run * 100) / total) : 0;
|
770
|
-
return this.setHtml("progress-percent", percent + "%");
|
771
|
-
};
|
772
|
-
|
773
|
-
return SimpleProgressView;
|
774
|
-
|
775
|
-
})(Teaspoon.Reporters.HTML.ProgressView);
|
776
|
-
|
777
|
-
Teaspoon.Reporters.HTML.RadialProgressView = (function(superClass) {
|
778
|
-
extend(RadialProgressView, superClass);
|
779
|
-
|
780
|
-
function RadialProgressView() {
|
781
|
-
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
782
|
-
}
|
783
|
-
|
784
|
-
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
785
|
-
|
786
|
-
RadialProgressView.prototype.build = function() {
|
787
|
-
this.el = this.createEl("div", "teaspoon-indicator radial-progress");
|
788
|
-
return this.el.innerHTML = "<canvas id=\"teaspoon-progress-canvas\"></canvas>\n<em id=\"teaspoon-progress-percent\">0%</em>";
|
789
|
-
};
|
790
|
-
|
791
|
-
RadialProgressView.prototype.appendTo = function() {
|
792
|
-
var canvas, e;
|
793
|
-
RadialProgressView.__super__.appendTo.apply(this, arguments);
|
794
|
-
this.size = 80;
|
795
|
-
try {
|
796
|
-
canvas = this.findEl("progress-canvas");
|
797
|
-
canvas.width = canvas.height = canvas.style.width = canvas.style.height = this.size;
|
798
|
-
this.ctx = canvas.getContext("2d");
|
799
|
-
this.ctx.strokeStyle = "#fff";
|
800
|
-
return this.ctx.lineWidth = 1.5;
|
801
|
-
} catch (_error) {
|
802
|
-
e = _error;
|
803
|
-
}
|
804
|
-
};
|
805
|
-
|
806
|
-
RadialProgressView.prototype.update = function(total, run) {
|
807
|
-
var half, percent;
|
808
|
-
percent = total ? Math.ceil((run * 100) / total) : 0;
|
809
|
-
this.setHtml("progress-percent", percent + "%");
|
810
|
-
if (!this.ctx) {
|
811
|
-
return;
|
812
|
-
}
|
813
|
-
half = this.size / 2;
|
814
|
-
this.ctx.clearRect(0, 0, this.size, this.size);
|
815
|
-
this.ctx.beginPath();
|
816
|
-
this.ctx.arc(half, half, half - 1, 0, Math.PI * 2 * (percent / 100), false);
|
817
|
-
return this.ctx.stroke();
|
818
|
-
};
|
819
|
-
|
820
|
-
return RadialProgressView;
|
821
|
-
|
822
|
-
})(Teaspoon.Reporters.HTML.ProgressView);
|
823
|
-
|
824
|
-
}).call(this);
|
825
|
-
(function() {
|
826
|
-
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; },
|
827
|
-
hasProp = {}.hasOwnProperty;
|
828
|
-
|
829
|
-
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
830
|
-
var viewId;
|
831
|
-
|
832
|
-
extend(SpecView, superClass);
|
833
|
-
|
834
|
-
viewId = 0;
|
835
|
-
|
836
|
-
function SpecView(spec, reporter) {
|
837
|
-
this.spec = spec;
|
838
|
-
this.reporter = reporter;
|
839
|
-
this.views = this.reporter.views;
|
840
|
-
this.spec.viewId = viewId += 1;
|
841
|
-
this.views.specs[this.spec.viewId] = this;
|
842
|
-
SpecView.__super__.constructor.apply(this, arguments);
|
843
|
-
}
|
844
|
-
|
845
|
-
SpecView.prototype.build = function() {
|
846
|
-
var classes;
|
847
|
-
classes = ["spec"];
|
848
|
-
if (this.spec.pending) {
|
849
|
-
classes.push("state-pending");
|
850
|
-
}
|
851
|
-
SpecView.__super__.build.call(this, classes.join(" "));
|
852
|
-
this.el.innerHTML = "<a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.description)) + "</a>";
|
853
|
-
this.parentView = this.buildParent();
|
854
|
-
return this.parentView.append(this.el);
|
855
|
-
};
|
856
|
-
|
857
|
-
SpecView.prototype.buildParent = function() {
|
858
|
-
var parent, view;
|
859
|
-
parent = this.spec.parent;
|
860
|
-
if (parent.viewId) {
|
861
|
-
return this.views.suites[parent.viewId];
|
862
|
-
} else {
|
863
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, this.reporter);
|
864
|
-
return this.views.suites[view.suite.viewId] = view;
|
865
|
-
}
|
866
|
-
};
|
867
|
-
|
868
|
-
SpecView.prototype.buildErrors = function() {
|
869
|
-
var div, error, html, i, len, ref;
|
870
|
-
div = this.createEl("div");
|
871
|
-
html = "";
|
872
|
-
ref = this.spec.errors();
|
873
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
874
|
-
error = ref[i];
|
875
|
-
html += "<strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable"));
|
876
|
-
}
|
877
|
-
div.innerHTML = html;
|
878
|
-
return this.append(div);
|
879
|
-
};
|
880
|
-
|
881
|
-
SpecView.prototype.updateState = function(state, elapsed) {
|
882
|
-
var base, classes, result;
|
883
|
-
result = this.spec.result();
|
884
|
-
classes = ["state-" + state];
|
885
|
-
if (elapsed > Teaspoon.slow) {
|
886
|
-
classes.push("slow");
|
887
|
-
}
|
888
|
-
if (state !== "failed") {
|
889
|
-
this.el.innerHTML += "<span>" + elapsed + "ms</span>";
|
890
|
-
}
|
891
|
-
this.el.className = classes.join(" ");
|
892
|
-
if (result.status !== "passed") {
|
893
|
-
this.buildErrors();
|
894
|
-
}
|
895
|
-
return typeof (base = this.parentView).updateState === "function" ? base.updateState(state) : void 0;
|
896
|
-
};
|
897
|
-
|
898
|
-
return SpecView;
|
899
|
-
|
900
|
-
})(Teaspoon.Reporters.BaseView);
|
901
|
-
|
902
|
-
}).call(this);
|
903
|
-
(function() {
|
904
|
-
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; },
|
905
|
-
hasProp = {}.hasOwnProperty;
|
906
|
-
|
907
|
-
Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
|
908
|
-
extend(FailureView, superClass);
|
909
|
-
|
910
|
-
function FailureView(spec) {
|
911
|
-
this.spec = spec;
|
912
|
-
FailureView.__super__.constructor.apply(this, arguments);
|
913
|
-
}
|
914
|
-
|
915
|
-
FailureView.prototype.build = function() {
|
916
|
-
var error, html, i, len, ref;
|
917
|
-
FailureView.__super__.build.call(this, "spec");
|
918
|
-
html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
|
919
|
-
ref = this.spec.errors();
|
920
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
921
|
-
error = ref[i];
|
922
|
-
html += "<div><strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
923
|
-
}
|
924
|
-
return this.el.innerHTML = html;
|
925
|
-
};
|
926
|
-
|
927
|
-
return FailureView;
|
928
|
-
|
929
|
-
})(Teaspoon.Reporters.BaseView);
|
930
|
-
|
931
|
-
}).call(this);
|
932
|
-
(function() {
|
933
|
-
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; },
|
934
|
-
hasProp = {}.hasOwnProperty;
|
935
|
-
|
936
|
-
Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
|
937
|
-
var viewId;
|
938
|
-
|
939
|
-
extend(SuiteView, superClass);
|
940
|
-
|
941
|
-
viewId = 0;
|
942
|
-
|
943
|
-
function SuiteView(suite, reporter) {
|
944
|
-
this.suite = suite;
|
945
|
-
this.reporter = reporter;
|
946
|
-
this.views = this.reporter.views;
|
947
|
-
this.suite.viewId = viewId += 1;
|
948
|
-
this.views.suites[this.suite.viewId] = this;
|
949
|
-
this.suite = new Teaspoon.Suite(this.suite);
|
950
|
-
SuiteView.__super__.constructor.apply(this, arguments);
|
951
|
-
}
|
952
|
-
|
953
|
-
SuiteView.prototype.build = function() {
|
954
|
-
SuiteView.__super__.build.call(this, "suite");
|
955
|
-
this.el.innerHTML = "<h1><a href=\"" + this.suite.link + "\">" + (this.htmlSafe(this.suite.description)) + "</a></h1>";
|
956
|
-
this.parentView = this.buildParent();
|
957
|
-
return this.parentView.append(this.el);
|
958
|
-
};
|
959
|
-
|
960
|
-
SuiteView.prototype.buildParent = function() {
|
961
|
-
var parent, view;
|
962
|
-
parent = this.suite.parent;
|
963
|
-
if (!parent) {
|
964
|
-
return this.reporter;
|
965
|
-
}
|
966
|
-
if (parent.viewId) {
|
967
|
-
return this.views.suites[parent.viewId];
|
968
|
-
} else {
|
969
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, this.reporter);
|
970
|
-
return this.views.suites[view.suite.viewId] = view;
|
971
|
-
}
|
972
|
-
};
|
973
|
-
|
974
|
-
SuiteView.prototype.append = function(el) {
|
975
|
-
if (!this.ol) {
|
976
|
-
SuiteView.__super__.append.call(this, this.ol = this.createEl("ol"));
|
977
|
-
}
|
978
|
-
return this.ol.appendChild(el);
|
979
|
-
};
|
980
|
-
|
981
|
-
SuiteView.prototype.updateState = function(state) {
|
982
|
-
var base;
|
983
|
-
if (this.state === "failed") {
|
984
|
-
return;
|
985
|
-
}
|
986
|
-
this.el.className = (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
987
|
-
if (typeof (base = this.parentView).updateState === "function") {
|
988
|
-
base.updateState(state);
|
989
|
-
}
|
990
|
-
return this.state = state;
|
991
|
-
};
|
992
|
-
|
993
|
-
return SuiteView;
|
994
|
-
|
995
|
-
})(Teaspoon.Reporters.BaseView);
|
996
|
-
|
997
|
-
}).call(this);
|
998
|
-
(function() {
|
999
|
-
Teaspoon.Reporters.HTML.template = function() {
|
1000
|
-
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\">∞</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>";
|
1001
|
-
};
|
1002
|
-
|
1003
|
-
}).call(this);
|
1004
|
-
(function() {
|
1005
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
1006
|
-
|
1007
|
-
Teaspoon.Reporters.Console = (function() {
|
1008
|
-
function Console() {
|
1009
|
-
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
1010
|
-
this.start = new Teaspoon.Date();
|
1011
|
-
this.suites = {};
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
Console.prototype.reportRunnerStarting = function(runner) {
|
1015
|
-
return this.log({
|
1016
|
-
type: "runner",
|
1017
|
-
total: runner.total || (typeof runner.specs === "function" ? runner.specs().length : void 0) || 0,
|
1018
|
-
start: JSON.parse(JSON.stringify(this.start))
|
1019
|
-
});
|
1020
|
-
};
|
1021
|
-
|
1022
|
-
Console.prototype.reportSuites = function() {
|
1023
|
-
var i, index, len, ref, results, suite;
|
1024
|
-
ref = this.spec.getParents();
|
1025
|
-
results = [];
|
1026
|
-
for (index = i = 0, len = ref.length; i < len; index = ++i) {
|
1027
|
-
suite = ref[index];
|
1028
|
-
if (this.suites[suite.fullDescription]) {
|
1029
|
-
continue;
|
1030
|
-
}
|
1031
|
-
this.suites[suite.fullDescription] = true;
|
1032
|
-
results.push(this.log({
|
1033
|
-
type: "suite",
|
1034
|
-
label: suite.description,
|
1035
|
-
level: index
|
1036
|
-
}));
|
1037
|
-
}
|
1038
|
-
return results;
|
1039
|
-
};
|
1040
|
-
|
1041
|
-
Console.prototype.reportSpecResults = function(spec) {
|
1042
|
-
var result;
|
1043
|
-
this.spec = new Teaspoon.Spec(spec);
|
1044
|
-
result = this.spec.result();
|
1045
|
-
if (result.skipped) {
|
1046
|
-
return;
|
1047
|
-
}
|
1048
|
-
this.reportSuites();
|
1049
|
-
switch (result.status) {
|
1050
|
-
case "pending":
|
1051
|
-
return this.trackPending();
|
1052
|
-
case "failed":
|
1053
|
-
return this.trackFailure();
|
1054
|
-
default:
|
1055
|
-
return this.log({
|
1056
|
-
type: "spec",
|
1057
|
-
suite: this.spec.suiteName,
|
1058
|
-
label: this.spec.description,
|
1059
|
-
status: result.status,
|
1060
|
-
skipped: result.skipped
|
1061
|
-
});
|
1062
|
-
}
|
1063
|
-
};
|
1064
|
-
|
1065
|
-
Console.prototype.trackPending = function() {
|
1066
|
-
var result;
|
1067
|
-
result = this.spec.result();
|
1068
|
-
return this.log({
|
1069
|
-
type: "spec",
|
1070
|
-
suite: this.spec.suiteName,
|
1071
|
-
label: this.spec.description,
|
1072
|
-
status: result.status,
|
1073
|
-
skipped: result.skipped
|
1074
|
-
});
|
1075
|
-
};
|
1076
|
-
|
1077
|
-
Console.prototype.trackFailure = function() {
|
1078
|
-
var error, i, len, ref, result, results;
|
1079
|
-
result = this.spec.result();
|
1080
|
-
ref = this.spec.errors();
|
1081
|
-
results = [];
|
1082
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
1083
|
-
error = ref[i];
|
1084
|
-
results.push(this.log({
|
1085
|
-
type: "spec",
|
1086
|
-
suite: this.spec.suiteName,
|
1087
|
-
label: this.spec.description,
|
1088
|
-
status: result.status,
|
1089
|
-
skipped: result.skipped,
|
1090
|
-
link: this.spec.fullDescription,
|
1091
|
-
message: error.message,
|
1092
|
-
trace: error.stack || error.message || "Stack Trace Unavailable"
|
1093
|
-
}));
|
1094
|
-
}
|
1095
|
-
return results;
|
1096
|
-
};
|
1097
|
-
|
1098
|
-
Console.prototype.reportRunnerResults = function() {
|
1099
|
-
this.log({
|
1100
|
-
type: "result",
|
1101
|
-
elapsed: ((new Teaspoon.Date().getTime() - this.start.getTime()) / 1000).toFixed(5),
|
1102
|
-
coverage: window.__coverage__
|
1103
|
-
});
|
1104
|
-
return Teaspoon.finished = true;
|
1105
|
-
};
|
1106
|
-
|
1107
|
-
Console.prototype.log = function(obj) {
|
1108
|
-
if (obj == null) {
|
1109
|
-
obj = {};
|
1110
|
-
}
|
1111
|
-
obj["_teaspoon"] = true;
|
1112
|
-
return Teaspoon.log(JSON.stringify(obj));
|
1113
|
-
};
|
1114
|
-
|
1115
|
-
return Console;
|
1116
|
-
|
1117
|
-
})();
|
1118
|
-
|
1119
|
-
}).call(this);
|
1120
|
-
(function() {
|
1121
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1122
|
-
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; },
|
1123
|
-
hasProp = {}.hasOwnProperty;
|
1124
|
-
|
1125
|
-
Teaspoon.Reporters.Console = (function(superClass) {
|
1126
|
-
extend(Console, superClass);
|
1127
|
-
|
1128
|
-
function Console(env) {
|
1129
|
-
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1130
|
-
Console.__super__.constructor.apply(this, arguments);
|
1131
|
-
env.log(this.reportSpecResults);
|
1132
|
-
env.testDone(this.reportSpecResults);
|
1133
|
-
env.done(this.reportRunnerResults);
|
1134
|
-
this.reportRunnerStarting();
|
1135
|
-
}
|
1136
|
-
|
1137
|
-
Console.prototype.reportRunnerStarting = function() {
|
1138
|
-
this.currentAssertions = [];
|
1139
|
-
return this.log({
|
1140
|
-
type: "runner",
|
1141
|
-
total: null,
|
1142
|
-
start: JSON.parse(JSON.stringify(this.start))
|
1143
|
-
});
|
1144
|
-
};
|
1145
|
-
|
1146
|
-
Console.prototype.reportSpecResults = function(result) {
|
1147
|
-
if (typeof result.total !== "number") {
|
1148
|
-
this.currentAssertions.push(result);
|
1149
|
-
return;
|
1150
|
-
}
|
1151
|
-
result.assertions = this.currentAssertions;
|
1152
|
-
this.currentAssertions = [];
|
1153
|
-
return Console.__super__.reportSpecResults.call(this, result);
|
1154
|
-
};
|
1155
|
-
|
1156
|
-
return Console;
|
1157
|
-
|
1158
|
-
})(Teaspoon.Reporters.Console);
|
1159
|
-
|
1160
|
-
}).call(this);
|
1161
|
-
(function() {
|
1162
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1163
|
-
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; },
|
1164
|
-
hasProp = {}.hasOwnProperty;
|
1165
|
-
|
1166
|
-
Teaspoon.Reporters.HTML = (function(superClass) {
|
1167
|
-
extend(HTML, superClass);
|
1168
|
-
|
1169
|
-
function HTML(env) {
|
1170
|
-
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
1171
|
-
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1172
|
-
HTML.__super__.constructor.apply(this, arguments);
|
1173
|
-
env.log(this.reportSpecResults);
|
1174
|
-
env.testDone(this.reportSpecResults);
|
1175
|
-
env.done(this.reportRunnerResults);
|
1176
|
-
this.currentAssertions = [];
|
1177
|
-
this.reportRunnerStarting();
|
1178
|
-
}
|
1179
|
-
|
1180
|
-
HTML.prototype.reportRunnerStarting = function() {
|
1181
|
-
this.total.exist = null;
|
1182
|
-
return this.setText("stats-duration", "...");
|
1183
|
-
};
|
1184
|
-
|
1185
|
-
HTML.prototype.reportSpecResults = function(spec) {
|
1186
|
-
if (typeof spec.total !== "number") {
|
1187
|
-
this.currentAssertions.push(spec);
|
1188
|
-
return;
|
1189
|
-
}
|
1190
|
-
spec.assertions = this.currentAssertions;
|
1191
|
-
this.currentAssertions = [];
|
1192
|
-
this.reportSpecStarting(spec);
|
1193
|
-
return HTML.__super__.reportSpecResults.call(this, spec);
|
1194
|
-
};
|
1195
|
-
|
1196
|
-
HTML.prototype.reportRunnerResults = function(result) {
|
1197
|
-
this.total.exist = this.total.run = result.total;
|
1198
|
-
return HTML.__super__.reportRunnerResults.apply(this, arguments);
|
1199
|
-
};
|
1200
|
-
|
1201
|
-
HTML.prototype.readConfig = function() {
|
1202
|
-
HTML.__super__.readConfig.apply(this, arguments);
|
1203
|
-
return QUnit.config.notrycatch = this.config["use-catch"];
|
1204
|
-
};
|
1205
|
-
|
1206
|
-
HTML.prototype.envInfo = function() {
|
1207
|
-
return "qunit " + (_qunit_version || "[unknown version]");
|
1208
|
-
};
|
1209
|
-
|
1210
|
-
return HTML;
|
1211
|
-
|
1212
|
-
})(Teaspoon.Reporters.HTML);
|
1213
|
-
|
1214
|
-
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
1215
|
-
extend(SpecView, superClass);
|
1216
|
-
|
1217
|
-
function SpecView() {
|
1218
|
-
return SpecView.__super__.constructor.apply(this, arguments);
|
1219
|
-
}
|
1220
|
-
|
1221
|
-
SpecView.prototype.buildErrors = function() {
|
1222
|
-
var div, error, html, i, len, ref;
|
1223
|
-
div = this.createEl("div");
|
1224
|
-
html = "";
|
1225
|
-
ref = this.spec.errors();
|
1226
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
1227
|
-
error = ref[i];
|
1228
|
-
html += "<strong>" + error.message + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "<br/>";
|
1229
|
-
}
|
1230
|
-
div.innerHTML = html;
|
1231
|
-
return this.append(div);
|
1232
|
-
};
|
1233
|
-
|
1234
|
-
SpecView.prototype.buildParent = function() {
|
1235
|
-
var parent, view;
|
1236
|
-
parent = this.spec.parent;
|
1237
|
-
if (!parent) {
|
1238
|
-
return this.reporter;
|
1239
|
-
}
|
1240
|
-
if (this.views.suites[parent.description]) {
|
1241
|
-
return this.views.suites[parent.description];
|
1242
|
-
} else {
|
1243
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, this.reporter);
|
1244
|
-
return this.views.suites[parent.description] = view;
|
1245
|
-
}
|
1246
|
-
};
|
1247
|
-
|
1248
|
-
return SpecView;
|
1249
|
-
|
1250
|
-
})(Teaspoon.Reporters.HTML.SpecView);
|
1251
|
-
|
1252
|
-
Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
|
1253
|
-
extend(FailureView, superClass);
|
1254
|
-
|
1255
|
-
function FailureView() {
|
1256
|
-
return FailureView.__super__.constructor.apply(this, arguments);
|
1257
|
-
}
|
1258
|
-
|
1259
|
-
FailureView.prototype.build = function() {
|
1260
|
-
var error, html, i, len, ref;
|
1261
|
-
FailureView.__super__.build.call(this, "spec");
|
1262
|
-
html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
|
1263
|
-
ref = this.spec.errors();
|
1264
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
1265
|
-
error = ref[i];
|
1266
|
-
html += "<div><strong>" + error.message + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
1267
|
-
}
|
1268
|
-
return this.el.innerHTML = html;
|
1269
|
-
};
|
1270
|
-
|
1271
|
-
return FailureView;
|
1272
|
-
|
1273
|
-
})(Teaspoon.Reporters.HTML.FailureView);
|
1274
|
-
|
1275
|
-
Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
|
1276
|
-
extend(SuiteView, superClass);
|
1277
|
-
|
1278
|
-
function SuiteView(suite, reporter) {
|
1279
|
-
this.suite = suite;
|
1280
|
-
this.reporter = reporter;
|
1281
|
-
this.views = this.reporter.views;
|
1282
|
-
this.views.suites[this.suite.description] = this;
|
1283
|
-
this.build();
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
return SuiteView;
|
1287
|
-
|
1288
|
-
})(Teaspoon.Reporters.HTML.SuiteView);
|
1289
|
-
|
1290
|
-
}).call(this);
|
1291
|
-
(function() {
|
1292
|
-
var env, originalReset,
|
1293
|
-
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; },
|
1294
|
-
hasProp = {}.hasOwnProperty;
|
1295
|
-
|
1296
|
-
if (typeof QUnit === "undefined" || QUnit === null) {
|
1297
|
-
throw new Teaspoon.Error('QUnit not found -- use `suite.use_framework :qunit` and adjust or remove the `suite.javascripts` directive.');
|
1298
|
-
}
|
1299
|
-
|
1300
|
-
Teaspoon.Runner = (function(superClass) {
|
1301
|
-
extend(Runner, superClass);
|
1302
|
-
|
1303
|
-
function Runner() {
|
1304
|
-
Runner.__super__.constructor.apply(this, arguments);
|
1305
|
-
env.start();
|
1306
|
-
}
|
1307
|
-
|
1308
|
-
Runner.prototype.setup = function() {
|
1309
|
-
return new (this.getReporter())(env);
|
1310
|
-
};
|
1311
|
-
|
1312
|
-
return Runner;
|
1313
|
-
|
1314
|
-
})(Teaspoon.Runner);
|
1315
|
-
|
1316
|
-
Teaspoon.Spec = (function() {
|
1317
|
-
function Spec(spec) {
|
1318
|
-
this.spec = spec;
|
1319
|
-
this.fullDescription = this.spec.module + " " + this.spec.name;
|
1320
|
-
this.description = this.spec.name + " (" + this.spec.failed + ", " + this.spec.passed + ", " + this.spec.total + ")";
|
1321
|
-
this.link = "?grep=" + (encodeURIComponent(this.spec.module + ": " + this.spec.name));
|
1322
|
-
this.parent = this.spec.module ? new Teaspoon.Suite({
|
1323
|
-
description: this.spec.module
|
1324
|
-
}) : null;
|
1325
|
-
this.suiteName = this.spec.module;
|
1326
|
-
this.viewId = this.spec.viewId;
|
1327
|
-
this.pending = false;
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
Spec.prototype.errors = function() {
|
1331
|
-
var i, item, len, ref, results;
|
1332
|
-
if (!this.spec.failed) {
|
1333
|
-
return [];
|
1334
|
-
}
|
1335
|
-
ref = this.spec.assertions;
|
1336
|
-
results = [];
|
1337
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
1338
|
-
item = ref[i];
|
1339
|
-
if (item.result) {
|
1340
|
-
continue;
|
1341
|
-
}
|
1342
|
-
this.provideFallbackMessage(item);
|
1343
|
-
results.push({
|
1344
|
-
message: item.message,
|
1345
|
-
stack: item.source
|
1346
|
-
});
|
1347
|
-
}
|
1348
|
-
return results;
|
1349
|
-
};
|
1350
|
-
|
1351
|
-
Spec.prototype.getParents = function() {
|
1352
|
-
if (!this.parent) {
|
1353
|
-
return [];
|
1354
|
-
}
|
1355
|
-
return [this.parent];
|
1356
|
-
};
|
1357
|
-
|
1358
|
-
Spec.prototype.result = function() {
|
1359
|
-
var status;
|
1360
|
-
status = "failed";
|
1361
|
-
if (!this.spec.failed) {
|
1362
|
-
status = "passed";
|
1363
|
-
}
|
1364
|
-
return {
|
1365
|
-
status: status,
|
1366
|
-
skipped: false
|
1367
|
-
};
|
1368
|
-
};
|
1369
|
-
|
1370
|
-
Spec.prototype.provideFallbackMessage = function(item) {
|
1371
|
-
if (item.message) {
|
1372
|
-
return;
|
1373
|
-
}
|
1374
|
-
if (item.actual && item.expected) {
|
1375
|
-
return item.message || (item.message = "Expected " + (JSON.stringify(item.actual)) + " to equal " + (JSON.stringify(item.expected)));
|
1376
|
-
} else {
|
1377
|
-
return item.message = 'failed';
|
1378
|
-
}
|
1379
|
-
};
|
1380
|
-
|
1381
|
-
return Spec;
|
1382
|
-
|
1383
|
-
})();
|
1384
|
-
|
1385
|
-
Teaspoon.Suite = (function() {
|
1386
|
-
function Suite(suite) {
|
1387
|
-
this.suite = suite;
|
1388
|
-
this.fullDescription = this.suite.description;
|
1389
|
-
this.description = this.suite.description;
|
1390
|
-
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
1391
|
-
this.parent = null;
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
return Suite;
|
1395
|
-
|
1396
|
-
})();
|
1397
|
-
|
1398
|
-
env = QUnit;
|
1399
|
-
|
1400
|
-
env.config.autostart = false;
|
1401
|
-
|
1402
|
-
env.config.altertitle = false;
|
1403
|
-
|
1404
|
-
env.config.filter = Teaspoon.Runner.prototype.getParams()["grep"];
|
1405
|
-
|
1406
|
-
window.fixture = Teaspoon.fixture;
|
1407
|
-
|
1408
|
-
originalReset = env.reset;
|
1409
|
-
|
1410
|
-
env.reset = function() {
|
1411
|
-
originalReset();
|
1412
|
-
return Teaspoon.fixture.cleanup();
|
1413
|
-
};
|
1414
|
-
|
1415
|
-
}).call(this);
|