Skip to content

Commit

Permalink
Revised iframe-behaviors spec to run in browser. Ported fixtures
Browse files Browse the repository at this point in the history
for nexted-iframe testing, don't have most asserts yet.
  • Loading branch information
gleneivey committed Apr 20, 2010
1 parent da5cab0 commit 9ddd013
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 129 deletions.
4 changes: 2 additions & 2 deletions specs/fixtures/scope/iframe1a.html
Expand Up @@ -2,9 +2,9 @@

<!--
* This file is a component of env.js,
* http://github.com/gleneivey/env-js/commits/master/README
* http://github.com/thatcher/env-js/
* a Pure JavaScript Browser Environment
* Copyright 2009 John Resig, licensed under the MIT License
* Copyright 2010 John Resig, licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
-->

Expand Down
4 changes: 2 additions & 2 deletions specs/fixtures/scope/iframe1b.html
Expand Up @@ -2,9 +2,9 @@

<!--
* This file is a component of env.js,
* http://github.com/gleneivey/env-js/commits/master/README
* http://github.com/thatcher/env-js/
* a Pure JavaScript Browser Environment
* Copyright 2009 John Resig, licensed under the MIT License
* Copyright 2010 John Resig, licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
-->

Expand Down
Expand Up @@ -3,9 +3,9 @@

<!--
* This file is a component of env.js,
* http://github.com/gleneivey/env-js/commits/master/README
* http://github.com/thatcher/env-js/
* a Pure JavaScript Browser Environment
* Copyright 2009 John Resig, licensed under the MIT License
* Copyright 2010 John Resig, licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
-->

Expand All @@ -16,13 +16,11 @@
</head>
<body>
<p id="firstPara">
First paragraph in <code>iframe.3.html</code>.
</p>

<iframe id="nested1Level" name="nested1Level" src="html/iframe2.html"></iframe>

First paragraph in <code>iframe2.html</code>.</p>
<iframe id="nested1Level" src="iframe3.html"
style='border: 3px solid yellow; padding: 1em; width: 95%; height: 870px;'>
</iframe>
<p id="lastPara">
Last paragraph in <code>iframe.3.html</code>.
</p>
Last paragraph in <code>iframe2.html</code>.</p>
</body>
</html>
42 changes: 42 additions & 0 deletions specs/fixtures/scope/iframe3.html
@@ -0,0 +1,42 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!--
* This file is a component of env.js,
* http://github.com/thatcher/env-js/
* a Pure JavaScript Browser Environment
* Copyright 2010 John Resig, licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
-->

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" dir="ltr" id="html">
<head>
<title>Content document for IFRAME loading in env.js unit test suite</title>
</head>
<body>
<p id="aParaInAnIframe">
Here is a short paragraph in <code>iframe3.html</code>.</p>
<p>Nesting level: <span id="nestingLevel">2</span></p>
<!--
The preceding is the seed value for the automatic iframe-nesting
count generation in <code>iframeN.html</code>, used by the nesting
test in <code>../../scope/spec.js</code>. Value must be equal to the
test's 'startingDepth' variable, minus 1, for things to work.
-->

<!-- matches code in iframeN.html -->
<script>
window.onload = function(){
var p = document.createElement('p');
p.setAttribute('id', "pCreatedIframeOnload" +
window.top.numberNestedIframeLoads);
var t = document.createTextNode("para window onload " +
window.top.numberNestedIframeLoads);
p.appendChild(t);
document.getElementsByTagName('body')[0].appendChild(p);
window.top.windowLoadCount++;
}
</script>
</body>
</html>
1 change: 1 addition & 0 deletions specs/fixtures/scope/iframe4.html
1 change: 1 addition & 0 deletions specs/fixtures/scope/iframe5.html
1 change: 1 addition & 0 deletions specs/fixtures/scope/iframe6.html
1 change: 1 addition & 0 deletions specs/fixtures/scope/iframe7.html
1 change: 1 addition & 0 deletions specs/fixtures/scope/iframe8.html
49 changes: 49 additions & 0 deletions specs/fixtures/scope/iframeN.html
@@ -0,0 +1,49 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!--
* This file is a component of env.js,
* http://github.com/thatcher/env-js/
* a Pure JavaScript Browser Environment
* Copyright 2010 John Resig, licensed under the MIT License
* http://www.opensource.org/licenses/mit-license.php
-->

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" dir="ltr" id="html">
<head>
<title>Document for testing arbitrary-depth IFRAME nesting in env.js</title>
</head>
<body onload="bodyOnloadHandler();">
<script>
window.top.numberNestedIframeLoads++;
window.onload = function(){
var p = document.createElement('p');
p.setAttribute('id', "pCreatedIframeOnload" +
window.top.numberNestedIframeLoads);
var t = document.createTextNode("para window onload " +
window.top.numberNestedIframeLoads);
p.appendChild(t);
document.getElementsByTagName('body')[0].appendChild(p);
window.top.windowLoadCount++;
}
</script>

<!--
This document will be loaded into an IFRAME, and the following
JavaScript finds an element in the parent document that contains
the nesting level count, increments it, and then produces an
identical element with the result in this document.
-->

<p>Nesting level:
<script>
var counterAsText = window.parent.document.
getElementById('nestingLevel').innerHTML;
var newCount = parseInt(counterAsText) + 1;
document.write('\x3cspan id="nestingLevel"\x3e' + newCount +
'\x3c/span\x3e');
</script>
</p>
</body>
</html>
45 changes: 0 additions & 45 deletions specs/obsolete-tests/html/iframe2.html

This file was deleted.

57 changes: 0 additions & 57 deletions specs/obsolete-tests/html/iframeN.html

This file was deleted.

3 changes: 3 additions & 0 deletions specs/scope/index.html
Expand Up @@ -44,6 +44,9 @@ <h2 id="qunit-userAgent"></h2>
<iframe id='loaded-iframe' style='display:none'
src='../fixtures/scope/iframe1a.html'></iframe>
<iframe id='empty-iframe' style='display:none'></iframe>
<iframe id='nesting-iframe'
style='border: 3px solid green; width: 100%; height: 1020px;'>
</iframe>
</div>
</body>
</html>

0 comments on commit 9ddd013

Please sign in to comment.