Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tmp/ | ||
dist/ | ||
dist/ | ||
tests/ember-validations-tests.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<!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" src="../lib/jquery-1.7.2.js"></script> | ||
<script type="text/javascript" src="../lib/ember.js"></script> | ||
<script type="text/javascript"> | ||
window.ENV = window.ENV || {}; | ||
|
||
// Handle extending prototypes | ||
QUnit.config.urlConfig.push('extendprototypes'); | ||
|
||
var extendPrototypes = QUnit.urlParams.extendprototypes; | ||
ENV['EXTEND_PROTOTYPES'] = !!extendPrototypes; | ||
|
||
// Handle CP cacheable by default | ||
QUnit.config.urlConfig.push('cpdefaultcacheable'); | ||
|
||
var cpDefaultCacheable = QUnit.urlParams.cpdefaultcacheable; | ||
ENV['CP_DEFAULT_CACHEABLE'] = !!cpDefaultCacheable; | ||
|
||
// Handle preserving context | ||
QUnit.config.urlConfig.push('viewpreservescontext'); | ||
|
||
var noViewPreservesContext = QUnit.urlParams.noviewpreservescontext; | ||
ENV['VIEW_PRESERVES_CONTEXT'] = !noViewPreservesContext; | ||
</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 type="text/javascript"> | ||
// Load ember distribution from query vars | ||
var distMatch = location.search.match(/dist=([^&]+)/), | ||
dist = (distMatch && distMatch[1]) || 'spade'; | ||
|
||
var distros = { | ||
spade: 'ember-validations-spade.js', | ||
build: 'ember-validations.js', | ||
prod: 'ember-validations.prod.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-validations-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 = (QUnit.urlParams.package || "").split(","), | ||
packageName, el, idx, len, re, match, moduleName; | ||
|
||
if (!packages.length) { | ||
el = document.getElementById('qunit-header'); | ||
el.innerHTML = 'Add package=package1,package2 in the URL to test packages'; | ||
} else { | ||
if (packages[0] === 'all') { | ||
packages = [ | ||
'ember-validations' | ||
]; | ||
} | ||
|
||
len = packages.length; | ||
|
||
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 && match[1] === '~tests') { | ||
minispade.require(moduleName); | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |