]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: Split out tests for deprecated offset option.
authorScott González <scott.gonzalez@gmail.com>
Tue, 22 Mar 2011 17:25:28 +0000 (13:25 -0400)
committerScott González <scott.gonzalez@gmail.com>
Tue, 22 Mar 2011 17:25:28 +0000 (13:25 -0400)
tests/unit/position/positio.html [new file with mode: 0644]
tests/unit/position/position.html
tests/unit/position/position_core.js
tests/unit/position/position_deprecated.js [new file with mode: 0644]

diff --git a/tests/unit/position/positio.html b/tests/unit/position/positio.html
new file mode 100644 (file)
index 0000000..156235d
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+       <meta charset="utf-8">
+       <title>jQuery UI Position Test Suite</title>
+
+       <script src="../../../jquery-1.5.1.js"></script>
+       <script src="../../../ui/jquery.ui.position.js"></script>
+
+       <link rel="stylesheet" href="../../../external/qunit.css">
+       <script src="../../../external/qunit.js"></script>
+       <script src="../../jquery.simulate.js"></script>
+       <script src="../testsuite.js"></script>
+
+       <script src="position_core.js"></script>
+       <script src="position_deprecated.js"></script>
+
+       <script src="../swarminject.js"></script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Position Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests">
+</ol>
+
+<!--
+elements smaller than 10px have a line-height set on them to avoid a bug in IE6
+.height() returns the greater of the height and line-height
+-->
+
+<div id="qunit-fixture" style="top: 0; left: 0;">
+       <div id="el1" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
+       <div id="el2" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
+       <div id="parent" style="position: absolute; width: 6px; height: 6px; top: 4px; left: 4px; line-height: 6px;"></div>
+</div>
+
+<div style="position: absolute; top: 0px; left: 0px">
+       <div id="elx" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+       <div id="parentx" style="position: absolute; width: 20px; height: 20px; top: 40px; left: 40px;"></div>
+</div>
+
+<div style="position: absolute; top: 200px; left: 100px;">
+       <div id="el-offset-100-200" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+       <div style="position: absolute; top: 100px; left: 50px;">
+               <div id="el-two-offset-150-300" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+               <div id="el-fixed" style="position: fixed; top: 200px; left: 200px;"></div>
+       </div>
+</div>
+
+<div style="position: absolute; height: 5000px; width: 5000px;"></div>
+
+<div id="bug-5280" style="height: 30px; width: 201px;">
+       <div style="width: 50px; height: 10px;"></div>
+</div>
+
+</body>
+</html>
index 40146d0d7d4334f2314d8c34b827f860026aaa5b..4f2e87e080bf524a149462ca4ec5aa3cd29e1d3f 100644 (file)
@@ -1,20 +1,23 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
-       <meta charset="UTF-8" />
+       <meta charset="utf-8">
        <title>jQuery UI Position Test Suite</title>
 
-       <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
+       <script src="../../../jquery-1.5.1.js"></script>
+       <script>
+       $.uiBackCompat = false;
+       </script>
+       <script src="../../../ui/jquery.ui.position.js"></script>
 
-       <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
-       <script type="text/javascript" src="../../../external/qunit.js"></script>
-       <script type="text/javascript" src="../../jquery.simulate.js"></script>
-       <script type="text/javascript" src="../testsuite.js"></script>
+       <link rel="stylesheet" href="../../../external/qunit.css">
+       <script src="../../../external/qunit.js"></script>
+       <script src="../../jquery.simulate.js"></script>
+       <script src="../testsuite.js"></script>
 
-       <script type="text/javascript" src="position_core.js"></script>
-       
-       <script type="text/javascript" src="../swarminject.js"></script>
+       <script src="position_core.js"></script>
+
+       <script src="../swarminject.js"></script>
 </head>
 <body>
 
index c6301d7137caffb13dabbdb9933c65feb9a07a19..5a47fe6bb2fd1357eba694bc047fac383fa1ec2f 100644 (file)
@@ -239,37 +239,6 @@ test( "offsets", function() {
        same( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" );
 });
 
-if ( $.uiBackCompat !== false ) {
-       test( "offset", function() {
-               $( "#elx" ).position({
-                       my: "left top",
-                       at: "left bottom",
-                       of: "#parentx",
-                       offset: "10",
-                       collision: "none"
-               });
-               same( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" );
-
-               $( "#elx" ).position({
-                       my: "left top",
-                       at: "left bottom",
-                       of: "#parentx",
-                       offset: "5 -3",
-                       collision: "none"
-               });
-               same( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" );
-
-               $( "#elx" ).position({
-                       my: "left top",
-                       at: "left bottom",
-                       of: "#parentx",
-                       offset: "5px -3px",
-                       collision: "none"
-               });
-               same( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" );
-       });
-}
-
 test( "using", function() {
        expect( 6 );
 
diff --git a/tests/unit/position/position_deprecated.js b/tests/unit/position/position_deprecated.js
new file mode 100644 (file)
index 0000000..3e72c4a
--- /dev/null
@@ -0,0 +1,32 @@
+(function( $ ) {
+
+test( "offset", function() {
+       $( "#elx" ).position({
+               my: "left top",
+               at: "left bottom",
+               of: "#parentx",
+               offset: "10",
+               collision: "none"
+       });
+       same( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" );
+
+       $( "#elx" ).position({
+               my: "left top",
+               at: "left bottom",
+               of: "#parentx",
+               offset: "5 -3",
+               collision: "none"
+       });
+       same( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" );
+
+       $( "#elx" ).position({
+               my: "left top",
+               at: "left bottom",
+               of: "#parentx",
+               offset: "5px -3px",
+               collision: "none"
+       });
+       same( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" );
+});
+
+}( jQuery ) );