From 359d0eadd02bae2aad1bf211c83ee4cda4dd39a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 28 May 2012 12:41:57 -0400 Subject: [PATCH] Accordion tests: equalHeights() -> equalHeight(); Validate against a specific height instead of a range. --- tests/unit/accordion/accordion_deprecated.js | 14 +++++++------- tests/unit/accordion/accordion_methods.js | 6 +++--- tests/unit/accordion/accordion_options.js | 10 +++++----- tests/unit/accordion/accordion_test_helpers.js | 9 ++------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/tests/unit/accordion/accordion_deprecated.js b/tests/unit/accordion/accordion_deprecated.js index 7f033a340..2068fef95 100644 --- a/tests/unit/accordion/accordion_deprecated.js +++ b/tests/unit/accordion/accordion_deprecated.js @@ -1,6 +1,6 @@ (function( $ ) { -var equalHeights = TestHelpers.accordion.equalHeights, +var equalHeight = TestHelpers.accordion.equalHeight, setupTeardown = TestHelpers.accordion.setupTeardown, state = TestHelpers.accordion.state; @@ -109,7 +109,7 @@ module( "accordion (deprecated) - height options", setupTeardown() ); test( "{ autoHeight: true }, default", function() { expect( 3 ); - equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 ); + equalHeight( $( "#navigation" ).accordion({ autoHeight: true }), 105 ); }); test( "{ autoHeight: false }", function() { @@ -128,7 +128,7 @@ test( "{ fillSpace: true }", function() { expect( 3 ); $( "#navigationWrapper" ).height( 500 ); var element = $( "#navigation" ).accordion({ fillSpace: true }); - equalHeights( element, 446, 458 ); + equalHeight( element, 455 ); }); test( "{ fillSapce: true } with sibling", function() { @@ -142,7 +142,7 @@ test( "{ fillSapce: true } with sibling", function() { }) .prependTo( "#navigationWrapper" ); var element = $( "#navigation" ).accordion({ fillSpace: true }); - equalHeights( element , 346, 358); + equalHeight( element , 355 ); }); test( "{ fillSpace: true } with multiple siblings", function() { @@ -171,7 +171,7 @@ test( "{ fillSpace: true } with multiple siblings", function() { }) .prependTo( "#navigationWrapper" ); var element = $( "#navigation" ).accordion({ fillSpace: true }); - equalHeights( element, 296, 308 ); + equalHeight( element, 305 ); }); @@ -206,11 +206,11 @@ test( "resize", function() { .accordion({ heightStyle: "fill" }); - equalHeights( element, 246, 258 ); + equalHeight( element, 255 ); element.parent().height( 500 ); element.accordion( "resize" ); - equalHeights( element, 446, 458 ); + equalHeight( element, 455 ); }); diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 2c5b36632..8723bcbb7 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -1,6 +1,6 @@ (function( $ ) { -var equalHeights = TestHelpers.accordion.equalHeights, +var equalHeight = TestHelpers.accordion.equalHeight, setupTeardown = TestHelpers.accordion.setupTeardown, state = TestHelpers.accordion.state; @@ -38,11 +38,11 @@ test( "refresh", function() { .accordion({ heightStyle: "fill" }); - equalHeights( element, 246, 258 ); + equalHeight( element, 255 ); element.parent().height( 500 ); element.accordion( "refresh" ); - equalHeights( element, 446, 458 ); + equalHeight( element, 455 ); }); }( jQuery ) ); diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 3c7863520..cd3370523 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -1,6 +1,6 @@ (function( $ ) { -var equalHeights = TestHelpers.accordion.equalHeights, +var equalHeight = TestHelpers.accordion.equalHeight, setupTeardown = TestHelpers.accordion.setupTeardown, state = TestHelpers.accordion.state; @@ -359,7 +359,7 @@ test( "{ header: custom }", function() { test( "{ heightStyle: 'auto' }", function() { expect( 3 ); var element = $( "#navigation" ).accordion({ heightStyle: "auto" }); - equalHeights( element, 95, 130 ); + equalHeight( element, 105 ); }); test( "{ heightStyle: 'content' }", function() { @@ -377,7 +377,7 @@ test( "{ heightStyle: 'fill' }", function() { expect( 3 ); $( "#navigationWrapper" ).height( 500 ); var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); - equalHeights( element, 446, 458 ); + equalHeight( element, 455 ); }); test( "{ heightStyle: 'fill' } with sibling", function() { @@ -391,7 +391,7 @@ test( "{ heightStyle: 'fill' } with sibling", function() { }) .prependTo( "#navigationWrapper" ); var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); - equalHeights( element , 346, 358); + equalHeight( element , 355 ); }); test( "{ heightStyle: 'fill' } with multiple siblings", function() { @@ -420,7 +420,7 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() { }) .prependTo( "#navigationWrapper" ); var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); - equalHeights( element, 296, 308 ); + equalHeight( element, 305 ); }); test( "{ icons: false }", function() { diff --git a/tests/unit/accordion/accordion_test_helpers.js b/tests/unit/accordion/accordion_test_helpers.js index 56967793d..643f8e283 100644 --- a/tests/unit/accordion/accordion_test_helpers.js +++ b/tests/unit/accordion/accordion_test_helpers.js @@ -1,13 +1,8 @@ TestHelpers.accordion = { - equalHeights: function( accordion, min, max ) { - var sizes = []; + equalHeight: function( accordion, height ) { accordion.find( ".ui-accordion-content" ).each(function() { - sizes.push( $( this ).outerHeight() ); + equal( $( this ).outerHeight(), height ); }); - ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max, - "must be within " + min + " and " + max + ", was " + sizes[ 0 ] ); - deepEqual( sizes[ 0 ], sizes[ 1 ] ); - deepEqual( sizes[ 0 ], sizes[ 2 ] ); }, setupTeardown: function() { -- 2.39.5