forked from jeresig/env-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into frame-scope
Conflicts: build.xml
- Loading branch information
Showing
5 changed files
with
159 additions
and
25 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
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,22 @@ | ||
|
||
/** | ||
* | ||
*/ | ||
var myprint = print; | ||
load('dist/env.rhino.js'); | ||
|
||
|
||
Envjs({ | ||
scriptTypes: { "text/javascript": true }, | ||
}); | ||
window.location = 'specs/fulldoc/index.html'; | ||
|
||
var div = window.document.getElementById('qunit-testresult'); | ||
var spans = div.getElementsByTagName('SPAN') | ||
|
||
var summary = {}; | ||
for (var i = 0; i < spans.length; ++i) { | ||
var clazz = spans[i].getAttribute('class'); | ||
summary[clazz] = parseInt(spans[i].textContent); | ||
myprint(clazz + ' = ' + summary[clazz]); | ||
} |
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,41 @@ | ||
<?xml encoding='utf-8'?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="eng" dir="ltr"> | ||
<head profile="http://a9.com/-/spec/opensearch/1.1/"> | ||
<title>Envjs Parser Spec</title> | ||
|
||
<link rel="stylesheet" | ||
media="screen" | ||
href="../qunit.css"/> | ||
|
||
<script src="../qunit.js" | ||
type="text/javascript" ></script> | ||
|
||
<script src="spec.js" | ||
type="text/javascript" ></script> | ||
|
||
|
||
</head> | ||
<body id="body"> | ||
<h1 id="qunit-header"> | ||
<img src="../fixtures/images/icon-green.png"/> | ||
<span>Envjs Parser Spec</span> | ||
</h1> | ||
<h2 id="qunit-banner"></h2> | ||
<h2 id="qunit-userAgent"></h2> | ||
<div id='qunit-testrunner-toolbar'></div> | ||
<div id='qunit-test-summary'> | ||
<ol id='qunit-tests'></ol> | ||
</div> | ||
<div id="qunit-main" style="display:none;"> | ||
<!-- | ||
Test HTML here: | ||
not required to be in here but it makes it convenient | ||
by convention to avoid having to look at the html | ||
artifacts the test may require or have generated as | ||
a side effect. | ||
--> | ||
</div> | ||
</body> | ||
</html> |
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,46 @@ | ||
QUnit.module('integration'); | ||
|
||
/** | ||
* This is very different from the other tests in that the "work" | ||
* in done, //outside// of a test(). The test() just check the | ||
* final results. This is needed since the tests must run in | ||
* <head> tag of the main document. | ||
*/ | ||
|
||
var isenvjs; | ||
try { | ||
isenvjs = runningUnderEnvjs(); | ||
} catch (e) { | ||
isenvjs= false; | ||
} | ||
/** | ||
* If a script in running in <head>, then document.body === null | ||
* | ||
* Due to frame scoping rules, we have indirectly make the test. | ||
* What we are really doing is this: | ||
* <html><head><script> | ||
* ok(document.body === null); | ||
* </script><head><body></body></html> | ||
*/ | ||
document.bodyinhead = document.body; | ||
|
||
/** | ||
* in <head> | ||
* Create a new <script> element attached to <head> | ||
* It should be run immediately(?) | ||
* | ||
*/ | ||
var s = document.createElement('script'); | ||
s.type = "text/javascript"; | ||
s.text = "document.fired = true;"; | ||
document.documentElement.getElementsByTagName("head")[0].appendChild(s) | ||
|
||
test('document.body is null in head', function() { | ||
expect(1); | ||
ok(document.bodyinhead === null, 'doc.body === null'); | ||
}); | ||
|
||
test('added new script to head from head', function() { | ||
expect(1); | ||
ok(document.fired === true, 'appended script element ran'); | ||
}); |
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