-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
181 lines (146 loc) · 5.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" src="minispade.js"></script>
<script type="text/javascript">
// Handle JSHint
QUnit.config.urlConfig.push('nojshint');
var noJsHint = location.search.match(/nojshint=([^&]+)/);
jsHint = !(noJsHint && decodeURIComponent(noJsHint[1]));
var jsHintReporter = function (file, errors) {
if (!errors) { return ''; }
var len = errors.length,
str = '',
error, idx;;
if (len === 0) { return ''; }
for (idx=0; idx<len; idx++) {
error = errors[idx];
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason + '\n';
};
return str + "\n" + len + ' error' + ((len === 1) ? '' : 's');
}
// Handle extending prototypes
QUnit.config.urlConfig.push('extendprototypes');
window.ENV = window.ENV || {};
var extendPrototypes = location.search.match(/extendprototypes=([^&]+)/);
ENV['EXTEND_PROTOTYPES'] = !!(extendPrototypes && decodeURIComponent(extendPrototypes[1]));
ENV['TESTING'] = true
</script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
<script>
// Load jshint if being used (can cause failurs in old environments if always loaded)
if (jsHint) {
document.write(unescape('%3Cscript src="jshint.js"%3E%3C/script%3E'));
}
// Close the script tag to make sure document.write happens
</script>
<script>
// Load custom version of jQuery if possible
var jQueryMatch = location.search.match(/jquery=([^&]+)/),
jQueryVersion = jQueryMatch ? jQueryMatch[1] : "1.8.3";
if (jQueryVersion !== 'none') {
document.write(unescape('%3Cscript src="http://ajax.googleapis.com/ajax/libs/jquery/'+jQueryVersion+'/jquery.js"%3E%3C/script%3E'));
}
// Close the script tag to make sure document.write happens
</script>
<script>
// Fallback to default jQuery
if (jQueryVersion !== 'none' && !window.jQuery) {
if (console && console.warn) { console.warn("Unable to load jQuery "+jQueryVersion+". Using default."); }
document.write(unescape('%3Cscript src="jquery-1.7.1.js"%3E%3C/script%3E'));
}
</script>
<script>
document.write(unescape('%3Cscript src="../dist/modules/ember.js"%3E%3C/script%3E'));
</script>
<script>
// Load ember distribution from query vars
var distMatch = location.search.match(/dist=([^&]+)/),
dist = (distMatch && distMatch[1]) || 'spade';
var distros = {
spade: 'ember-forms-spade.js',
build: 'ember-forms.js'
};
var emberFile = distros[dist];
if (!emberFile) { throw 'Unknown dist'; }
document.write(unescape('%3Cscript src="../dist/'+emberFile+'"%3E%3C/script%3E'));
// Close the script tag to make sure document.write happens
</script>
<script type="text/javascript" src="ember-forms-tests.js"></script>
<script type="text/javascript">
// hack qunit to not suck for Ember objects
var originalTypeof = QUnit.jsDump.typeOf;
QUnit.jsDump.typeOf = function(obj) {
if (Ember && Ember.Object && Ember.Object.detectInstance(obj)) {
return "emberObject";
}
return originalTypeof.call(this, obj);
};
QUnit.jsDump.parsers.emberObject = function(obj) {
return obj.toString();
}
// Load Tests and Depenencies
var packages = location.search.match(/package=([^&]+)/),
packageName, el, idx, len, re, match, moduleName;
if (!packages) {
el = document.getElementById('qunit-header');
el.innerHTML = 'Add package=package1,package2 in the URL to test packages';
} else {
if (packages[1] === 'all') {
packages = [
'ember-forms'
];
} else {
packages = packages[1].split(',');
}
len = packages.length;
// There is no require for this in the code
if (dist == 'spade') {
minispade.require('ember');
}
for (idx=0; idx<len; idx++) {
packageName = packages[idx];
re = new RegExp('^'+packageName+'/([^/]+)');
if (dist == 'spade') {
minispade.require(packageName);
}
for (moduleName in minispade.modules) {
if (!minispade.modules.hasOwnProperty(moduleName)) { continue; }
match = moduleName.match(re);
if (match) {
if (match[1] === '~tests') {
// Only require the actual tests since we already required the module
minispade.require(moduleName);
}
if (jsHint) {
// JSHint all modules in this package, tests and code
// (closure to preserve variable values)
(function() {
var jshintModule = moduleName;
test(jshintModule+' should pass jshint', function() {
var passed = JSHINT(minispade.modules[jshintModule], JSHINTRC),
errors = jsHintReporter(jshintModule, JSHINT.errors);
ok(passed, jshintModule+" should pass jshint."+(errors ? "\n"+errors : ''));
});
})();
}
}
}
}
}
</script>
</body>
</html>