Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: efddc3a664
Fetching contributors…

Cannot retrieve contributors at this time

187 lines (151 sloc) 5.786 kb
<!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="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.7.1";
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-addons-spade.js',
build: 'ember-addons.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-addons-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-datetime',
'ember-form',
'ember-history',
'ember-overlay',
'ember-responder',
'ember-utils',
'ember-validators'
];
} 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>
Jump to Line
Something went wrong with that request. Please try again.