]> source.dussan.org Git - jquery.git/commitdiff
Adds unit/support.js to unit tests. Still have to test for #8763 has to be done in...
authorjaubourg <j@ubourg.net>
Tue, 10 May 2011 10:23:53 +0000 (12:23 +0200)
committerjaubourg <j@ubourg.net>
Tue, 10 May 2011 10:24:36 +0000 (12:24 +0200)
test/boxModelIE.html [deleted file]
test/data/support/boxModelIE.html [new file with mode: 0644]
test/data/support/hiddenIFrameFF.html [new file with mode: 0644]
test/index.html
test/unit/support.js [new file with mode: 0644]

diff --git a/test/boxModelIE.html b/test/boxModelIE.html
deleted file mode 100644 (file)
index f8e6a43..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<body>
-       <h3>jQuery Test boxModel detection in IE 6 & 7 compatMode="CSS1Compat"</h3>
-       <div>document.compatMode = <span id="compat-mode">?</span></div>
-       <div>jQuery.support.boxModel = <span id="box-model">?</span></div>
-       <script src="../src/core.js"></script>
-       <script src="../src/deferred.js"></script>
-       <script src="../src/support.js"></script>
-       <script src="../src/data.js"></script>
-       <script src="../src/queue.js"></script>
-       <script src="../src/attributes.js"></script>
-       <script src="../src/event.js"></script>
-       <script src="../src/sizzle/sizzle.js"></script>
-       <script src="../src/sizzle-jquery.js"></script>
-       <script src="../src/traversing.js"></script>
-       <script src="../src/manipulation.js"></script>
-       <script src="../src/css.js"></script>
-       <script src="../src/ajax.js"></script>
-       <script src="../src/ajax/jsonp.js"></script>
-       <script src="../src/ajax/script.js"></script>
-       <script src="../src/ajax/xhr.js"></script>
-       <script src="../src/effects.js"></script>
-       <script src="../src/offset.js"></script>
-       <script src="../src/dimensions.js"></script>
-       <script>
-       jQuery(function() {
-               jQuery( "#compat-mode" ).text( document.compatMode );
-               jQuery( "#box-model" ).text( jQuery.support.boxModel );
-       });
-       </script>
-</body>
-</html>
\ No newline at end of file
diff --git a/test/data/support/boxModelIE.html b/test/data/support/boxModelIE.html
new file mode 100644 (file)
index 0000000..1b11d2a
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<body>
+       <script src="../../../src/core.js"></script>
+       <script src="../../../src/deferred.js"></script>
+       <script src="../../../src/support.js"></script>
+       <script src="../../../src/data.js"></script>
+       <script src="../../../src/queue.js"></script>
+       <script src="../../../src/attributes.js"></script>
+       <script src="../../../src/event.js"></script>
+       <script src="../../../src/sizzle/sizzle.js"></script>
+       <script src="../../../src/sizzle-jquery.js"></script>
+       <script src="../../../src/traversing.js"></script>
+       <script src="../../../src/manipulation.js"></script>
+       <script src="../../../src/css.js"></script>
+       <script src="../../../src/ajax.js"></script>
+       <script src="../../../src/ajax/jsonp.js"></script>
+       <script src="../../../src/ajax/script.js"></script>
+       <script src="../../../src/ajax/xhr.js"></script>
+       <script src="../../../src/effects.js"></script>
+       <script src="../../../src/offset.js"></script>
+       <script src="../../../src/dimensions.js"></script>
+       <script>
+       window.top.supportCallback( document.compatMode, jQuery.support.boxModel );
+       </script>
+</body>
+</html>
diff --git a/test/data/support/hiddenIFrameFF.html b/test/data/support/hiddenIFrameFF.html
new file mode 100644 (file)
index 0000000..000ac85
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+       <head>
+               <script src="../../../src/core.js"></script>
+               <script src="../../../src/deferred.js"></script>
+               <script src="../../../src/support.js"></script>
+               <script src="../../../src/data.js"></script>
+               <script src="../../../src/queue.js"></script>
+               <script src="../../../src/attributes.js"></script>
+               <script src="../../../src/event.js"></script>
+               <script src="../../../src/sizzle/sizzle.js"></script>
+               <script src="../../../src/sizzle-jquery.js"></script>
+               <script src="../../../src/traversing.js"></script>
+               <script src="../../../src/manipulation.js"></script>
+               <script src="../../../src/css.js"></script>
+               <script src="../../../src/ajax.js"></script>
+               <script src="../../../src/ajax/jsonp.js"></script>
+               <script src="../../../src/ajax/script.js"></script>
+               <script src="../../../src/ajax/xhr.js"></script>
+               <script src="../../../src/effects.js"></script>
+               <script src="../../../src/offset.js"></script>
+               <script src="../../../src/dimensions.js"></script>
+       </head>
+       <body>
+       </body>
+</html>
index 3d421a565a895c61d834053c1af2359c9f35f1ff..4b4c98552e7da5f5a469773415e4572fa2b97076 100644 (file)
@@ -34,6 +34,7 @@
        <script src="data/testrunner.js"></script>
 
        <script src="unit/core.js"></script>
+       <script src="unit/support.js"></script>
        <script src="unit/deferred.js"></script>
        <script src="unit/data.js"></script>
        <script src="unit/queue.js"></script>
diff --git a/test/unit/support.js b/test/unit/support.js
new file mode 100644 (file)
index 0000000..9d99529
--- /dev/null
@@ -0,0 +1,32 @@
+module("support", { teardown: moduleTeardown });
+
+function supportIFrameTest( title, url, noDisplay, func ) {
+
+       if ( noDisplay !== true ) {
+               func = noDisplay;
+               noDisplay = false;
+       }
+
+       test( title, function() {
+               var iframe;
+
+               stop();
+               window.supportCallback = function() {
+                       var self = this,
+                               args = arguments;
+                       setTimeout( function() {
+                               window.supportCallback = undefined;
+                               iframe.remove();
+                               func.apply( self, args );
+                               start();
+                       }, 0 );
+               };
+               iframe = jQuery( "<div/>" ).css( "display", noDisplay ? "none" : "block" ).append(
+                               jQuery( "<iframe/>" ).attr( "src", "data/support/" + url + ".html" )
+                       ).appendTo( "body" );
+       });
+}
+
+supportIFrameTest( "proper boxModel in compatMode CSS1Compat (IE6 and IE7)", "boxModelIE", function( compatMode, boxModel ) {
+       ok( compatMode !== "CSS1Compat" || boxModel, "boxModel properly detected" );
+});