Skip to content

Commit

Permalink
Reorg test directories: No more /test. Active in /specs, all no-longe…
Browse files Browse the repository at this point in the history
…r-used

test files moved under /specs/obsolete-tests.  (Hope nobody had private
scripts that this breaks....)
  • Loading branch information
gleneivey committed Apr 13, 2010
1 parent baa4ac7 commit 700c791
Show file tree
Hide file tree
Showing 113 changed files with 70 additions and 65 deletions.
6 changes: 3 additions & 3 deletions README
Expand Up @@ -83,12 +83,12 @@ Getting the code:

== contributing tests with patches ==

Each module has a spec in env-js/test/spec. Most tests will run whether you
Each module has a spec in env-js/specs. Most tests will run whether you
load them in the file:, http:, or https:, though once you get to xhr.js
the tests will fail for the 'file:' protocol in firefox because of
permissions. To run xhr.js and window.js specs, copy settings.js to
local_settings.js and run a local server to satisfy those urls included in
the spec.js;
local_settings.js, update it, and run a local server to satisfy
those urls included in the spec.js;


== platforms ==
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -36,7 +36,7 @@
location="${PREFIX}/docs"
description="Folder for docs target" />
<property name="TEST_DIR"
location="${basedir}/test/specs"
location="${basedir}/specs"
description="Folder for test target" />
<property name="DIST_DIR"
location="${PREFIX}/"
Expand Down
6 changes: 3 additions & 3 deletions test/specs/console/boot.js → specs/console/boot.js
Expand Up @@ -3,14 +3,14 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
load('dist/platform/core.js');
load('dist/platform/rhino.js');
load('dist/console.js');
load('test/specs/console/spec.js');
load('specs/console/spec.js');
start();

2 changes: 1 addition & 1 deletion test/specs/console/index.html → specs/console/index.html
Expand Up @@ -16,7 +16,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Console Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/css/boot.js → specs/css/boot.js
Expand Up @@ -3,8 +3,8 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
Expand All @@ -14,6 +14,6 @@ load('dist/dom.js');
load('dist/event.js');
load('dist/html.js');
load('dist/css.js');
load('test/specs/css/spec.js');
load('specs/css/spec.js');
start();

2 changes: 1 addition & 1 deletion test/specs/css/index.html → specs/css/index.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs CSS Spec</span>
</h1>
<h2 id="qunit-banner"></h2>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/dom/boot.js → specs/dom/boot.js
Expand Up @@ -3,14 +3,14 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
load('dist/platform/rhino.js');
load('dist/console.js');
load('dist/dom.js');
load('test/specs/dom/spec.js');
load('specs/dom/spec.js');
start();

2 changes: 1 addition & 1 deletion test/specs/dom/index.html → specs/dom/index.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs DOM Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/event/boot.js → specs/event/boot.js
Expand Up @@ -3,15 +3,15 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
load('dist/platform/rhino.js');
load('dist/console.js');
load('dist/dom.js');
load('dist/event.js');
load('test/specs/event/spec.js');
load('specs/event/spec.js');
start();

2 changes: 1 addition & 1 deletion test/specs/event/index.html → specs/event/index.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Event Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion test/specs/frame/proxy.html → specs/frame/proxy.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Proxy Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/html/boot.js → specs/html/boot.js
Expand Up @@ -3,8 +3,8 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
Expand All @@ -13,6 +13,6 @@ load('dist/console.js');
load('dist/dom.js');
load('dist/event.js');
load('dist/html.js');
load('test/specs/html/spec.js');
load('specs/html/spec.js');
start();

2 changes: 1 addition & 1 deletion test/specs/html/index.html → specs/html/index.html
Expand Up @@ -16,7 +16,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs HTML Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/parser/boot.js → specs/parser/boot.js
Expand Up @@ -3,8 +3,8 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
Expand All @@ -15,6 +15,6 @@ load('dist/event.js');
load('dist/html.js');
load('dist/timer.js');
load('dist/parser.js');
load('test/specs/parser/spec.js');
load('specs/parser/spec.js');
start();
Envjs.wait();
2 changes: 1 addition & 1 deletion test/specs/parser/index.html → specs/parser/index.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Parser Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/specs/platform/rhino.js → specs/platform/rhino.js
@@ -1,5 +1,5 @@
load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/timer/boot.js → specs/timer/boot.js
Expand Up @@ -3,15 +3,15 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
load('dist/platform/rhino.js');
load('dist/console.js');
load('dist/timer.js');
load('test/specs/timer/spec.js');
load('specs/timer/spec.js');

start();
Envjs.wait();
2 changes: 1 addition & 1 deletion test/specs/timer/index.html → specs/timer/index.html
Expand Up @@ -17,7 +17,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Timer Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/specs/window/boot.js → specs/window/boot.js
Expand Up @@ -13,12 +13,12 @@ load('dist/parser.js');
load('dist/xhr.js');
load('dist/window.js');

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');

load('local_settings.js');
load('test/specs/window/spec.js');
load('specs/window/spec.js');


location = 'test/specs/window/index.html';
location = 'specs/window/index.html';
Envjs.wait();
2 changes: 1 addition & 1 deletion test/specs/window/index.html → specs/window/index.html
Expand Up @@ -25,7 +25,7 @@
</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs Window Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/specs/xhr/boot.js → specs/xhr/boot.js
Expand Up @@ -3,8 +3,8 @@
* @author thatcher
*/

load('test/specs/qunit.js');
load('test/specs/env.qunit.js');
load('specs/qunit.js');
load('specs/env.qunit.js');
QUnit.init();

load('dist/platform/core.js');
Expand All @@ -17,6 +17,6 @@ load('dist/timer.js');
load('dist/parser.js');
load('dist/xhr.js');
load('local_settings.js');
load('test/specs/xhr/spec.js');
load('specs/xhr/spec.js');
start();
Envjs.wait();
6 changes: 3 additions & 3 deletions test/specs/xhr/index.html → specs/xhr/index.html
Expand Up @@ -10,16 +10,16 @@

<script src="../qunit.js"
type="text/javascript" ></script>
<script src="spec.js"
<script src="../../local_settings.js"
type="text/javascript" ></script>
<script src="../../../local_settings.js"
<script src="spec.js"
type="text/javascript" ></script>


</head>
<body id="body">
<h1 id="qunit-header">
<img src="../../fixtures/images/icon-green.png"/>
<img src="../fixtures/images/icon-green.png"/>
<span>Envjs XMLHttpRequest Spec</span>
</h1>
<h2 id="qunit-userAgent"></h2>
Expand Down
43 changes: 24 additions & 19 deletions test/specs/xhr/spec.js → specs/xhr/spec.js
Expand Up @@ -8,17 +8,20 @@ test('XMLHttpRequest Interfaces Available', function(){

});

// mock the global document object if not available
var expected_path = 'test/specs/xhr/index.html';
var expected_path_a = 'specs/xhr/index.html';
var expected_path_b = 'specs/xhr/';
var url = SETTINGS.AJAX_BASE +'specs/fixtures/simple.txt';

// mock the global document object if not available
try{
document;
}catch(e){
console.log('mocking global document object.');
document = new HTMLDocument(new DOMImplementation());

console.log('mocking global document location.');
location = new Location(Envjs.uri(expected_path, SETTINGS.AJAX_BASE), document);
location = new Location(Envjs.uri(expected_path_a, SETTINGS.AJAX_BASE),
document);
document.baseURI = location.href;
location.reload();

Expand All @@ -27,25 +30,32 @@ try{

test('Location', function(){

var href = SETTINGS.AJAX_BASE+expected_path;
var href_a = SETTINGS.AJAX_BASE+expected_path_a;
var href_b = SETTINGS.AJAX_BASE+expected_path_b;

ok(//this test may run in xhr or env so we allow for both paths
location.toString() === href ||
location.toString() === href.replace('xhr','env'),
location.toString() === href_a ||
location.toString() === href_b ||
location.toString() === href_a.replace('xhr','env'),
'.toString()'
);
equals(location.hash, '', '.hash');
var port = (SETTINGS.LOCAL_PORT == "") ? "" : (":" + SETTINGS.LOCAL_PORT);
equals(location.host, 'localhost'+port, '.host');
equals(location.hostname, 'localhost', '.hostname');
ok(//this test may run in xhr or env so we allow for both paths
location.href === href ||
location.href === href.replace('xhr','env'),
ok(
location.href === href_a ||
location.href === href_b ||
//this test may run in xhr or env so we allow for both paths
location.href === href.replace('xhr','env'),
'.href'
);
ok(//this test may run in xhr or env so we allow for both paths
location.pathname === '/env-js/'+expected_path ||
location.pathname === ('/env-js/'+expected_path).replace('xhr','env'),
ok(
location.pathname === '/env-js/'+expected_path_a ||
location.pathname === '/env-js/'+expected_path_b ||
//this test may run in xhr or env so we allow for both paths
location.pathname === ('/env-js/'+expected_path).
replace('xhr','env'),
'.href'
);
equals(location.port, SETTINGS.LOCAL_PORT, '.port');
Expand All @@ -55,11 +65,8 @@ test('Location', function(){
});

test('XMLHttpRequest sync', function(){
var xhr,
url;
var xhr;

url = SETTINGS.AJAX_BASE +'test/fixtures/simple.txt';

xhr = new XMLHttpRequest();
equals(xhr.readyState, 0, '.readyState');

Expand All @@ -76,10 +83,8 @@ test('XMLHttpRequest sync', function(){


test('XMLHttpRequest async', function(){
var xhr,
url;
var xhr;

url = SETTINGS.AJAX_BASE +'test/fixtures/simple.txt';
xhr = new XMLHttpRequest();
equals(xhr.readyState, 0, '.readyState');
equals(xhr.responseText, '', '.responseText');
Expand Down

0 comments on commit 700c791

Please sign in to comment.