aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanny Trunk <dtrunk90@googlemail.com>2012-05-28 15:11:20 -0400
committerScott González <scott.gonzalez@gmail.com>2012-05-28 15:11:20 -0400
commit6e2f95f59d73d86a2b84faecba3fca593534b8c9 (patch)
tree0027d165ef02ba1e67543afd7ac5769203480344 /tests
parent2662edf7393d2fbe594b22f6294e14725847a8e8 (diff)
downloadjquery-ui-6e2f95f59d73d86a2b84faecba3fca593534b8c9.tar.gz
jquery-ui-6e2f95f59d73d86a2b84faecba3fca593534b8c9.zip
Tabs: Added heightStyle option. Fixed #8345 - Tabs: Add heightStyle option.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/tabs/tabs.html25
-rw-r--r--tests/unit/tabs/tabs_common.js1
-rw-r--r--tests/unit/tabs/tabs_common_deprecated.js1
-rw-r--r--tests/unit/tabs/tabs_deprecated.html25
-rw-r--r--tests/unit/tabs/tabs_options.js67
-rw-r--r--tests/unit/tabs/tabs_test_helpers.js6
6 files changed, 125 insertions, 0 deletions
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index b9fa507d8..3a55f3b79 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -31,6 +31,14 @@
<script src="tabs_options.js"></script>
<script src="../swarminject.js"></script>
+ <style>
+ #tabs8, #tabs8 * {
+ margin: 0;
+ padding: 0;
+ font-size: 12px;
+ line-height: 15px;
+ }
+ </style>
</head>
<body>
@@ -120,6 +128,23 @@
<div id="tabs7-1"></div>
</div>
+<div id="tabs8Wrapper">
+ <div id="tabs8">
+ <ul id="tabs8-list">
+ <li><a href="#tabs8-1">1</a></li>
+ <li><a href="#tabs8-2">2</a></li>
+ </ul>
+ <div id="tabs8-1">
+ <p>Lorem ipsum</p>
+ <p>Lorem ipsum</p>
+ <p>Lorem ipsum</p>
+ </div>
+ <div id="tabs8-2">
+ <p>Lorem ipsum</p>
+ </div>
+ </div>
+</div>
+
</div>
</body>
</html>
diff --git a/tests/unit/tabs/tabs_common.js b/tests/unit/tabs/tabs_common.js
index b98ff3575..a589515f8 100644
--- a/tests/unit/tabs/tabs_common.js
+++ b/tests/unit/tabs/tabs_common.js
@@ -4,6 +4,7 @@ TestHelpers.commonWidgetTests( "tabs", {
collapsible: false,
disabled: false,
event: "click",
+ heightStyle: "content",
hide: null,
show: null,
diff --git a/tests/unit/tabs/tabs_common_deprecated.js b/tests/unit/tabs/tabs_common_deprecated.js
index 718ae8272..5b41014da 100644
--- a/tests/unit/tabs/tabs_common_deprecated.js
+++ b/tests/unit/tabs/tabs_common_deprecated.js
@@ -7,6 +7,7 @@ TestHelpers.commonWidgetTests( "tabs", {
cookie: null,
disabled: false,
event: "click",
+ heightStyle: "content",
hide: null,
fx: null,
idPrefix: "ui-tabs-",
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
index e58382efb..bb4088350 100644
--- a/tests/unit/tabs/tabs_deprecated.html
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -30,6 +30,14 @@
<script src="tabs_deprecated.js"></script>
<script src="../swarminject.js"></script>
+ <style>
+ #tabs8, #tabs8 * {
+ margin: 0;
+ padding: 0;
+ font-size: 12px;
+ line-height: 15px;
+ }
+ </style>
</head>
<body>
@@ -119,6 +127,23 @@
<div id="tabs7-1"></div>
</div>
+<div id="tabs8Wrapper">
+ <div id="tabs8">
+ <ul id="tabs8-list">
+ <li><a href="#tabs8-1">1</a></li>
+ <li><a href="#tabs8-2">2</a></li>
+ </ul>
+ <div id="tabs8-1">
+ <p>Lorem ipsum</p>
+ <p>Lorem ipsum</p>
+ <p>Lorem ipsum</p>
+ </div>
+ <div id="tabs8-2">
+ <p>Lorem ipsum</p>
+ </div>
+ </div>
+</div>
+
</div>
</body>
</html>
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index df6827c57..8365a42d7 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -1,6 +1,7 @@
(function( $ ) {
var disabled = TestHelpers.tabs.disabled,
+ equalHeight = TestHelpers.tabs.equalHeight,
state = TestHelpers.tabs.state;
module( "tabs: options" );
@@ -211,6 +212,72 @@ test( "{ event: custom }", function() {
state( element, 0, 1, 0 );
});
+test( "{ heightStyle: 'auto' }", function() {
+ expect( 2 );
+ var element = $( "#tabs8" ).tabs({ heightStyle: "auto" });
+ equalHeight( element, 45 );
+});
+
+test( "{ heightStyle: 'content' }", function() {
+ expect( 2 );
+ var element = $( "#tabs8" ).tabs({ heightStyle: "content" }),
+ sizes = element.find( ".ui-tabs-panel" ).map(function() {
+ return $( this ).height();
+ }).get();
+ equal( sizes[ 0 ], 45 );
+ equal( sizes[ 1 ], 15 );
+});
+
+test( "{ heightStyle: 'fill' }", function() {
+ expect( 2 );
+ $( "#tabs8Wrapper" ).height( 500 );
+ var element = $( "#tabs8" ).tabs({ heightStyle: "fill" });
+ equalHeight( element, 485 );
+});
+
+test( "{ heightStyle: 'fill' } with sibling", function() {
+ expect( 2 );
+ $( "#tabs8Wrapper" ).height( 500 );
+ $( "<p>Lorem Ipsum</p>" )
+ .css({
+ height: 50,
+ marginTop: 20,
+ marginBottom: 30
+ })
+ .prependTo( "#tabs8Wrapper" );
+ var element = $( "#tabs8" ).tabs({ heightStyle: "fill" });
+ equalHeight( element, 385 );
+});
+
+test( "{ heightStyle: 'fill' } with multiple siblings", function() {
+ expect( 2 );
+ $( "#tabs8Wrapper" ).height( 500 );
+ $( "<p>Lorem Ipsum</p>" )
+ .css({
+ height: 50,
+ marginTop: 20,
+ marginBottom: 30
+ })
+ .prependTo( "#tabs8Wrapper" );
+ $( "<p>Lorem Ipsum</p>" )
+ .css({
+ height: 50,
+ marginTop: 20,
+ marginBottom: 30,
+ position: "absolute"
+ })
+ .prependTo( "#tabs8Wrapper" );
+ $( "<p>Lorem Ipsum</p>" )
+ .css({
+ height: 25,
+ marginTop: 10,
+ marginBottom: 15
+ })
+ .prependTo( "#tabs8Wrapper" );
+ var element = $( "#tabs8" ).tabs({ heightStyle: "fill" });
+ equalHeight( element, 335 );
+});
+
// TODO: add animation tests
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_test_helpers.js b/tests/unit/tabs/tabs_test_helpers.js
index 508043943..0c9309186 100644
--- a/tests/unit/tabs/tabs_test_helpers.js
+++ b/tests/unit/tabs/tabs_test_helpers.js
@@ -38,6 +38,12 @@ TestHelpers.tabs = {
deepEqual( actual, expected );
},
+ equalHeight: function( tabs, height ) {
+ tabs.find( ".ui-tabs-panel" ).each(function() {
+ equal( $( this ).outerHeight(), height );
+ });
+ },
+
state: function( tabs ) {
var expected = $.makeArray( arguments ).slice( 1 ),
actual = tabs.find( ".ui-tabs-nav li" ).map(function() {