diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-01-25 00:05:55 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-01-25 00:05:55 -0500 |
commit | 088ef05142168de75d2afcbe447a5b44cb2d3673 (patch) | |
tree | 25c75a5a1a2dcd70d6c4324c13ae4e49ee4e8c67 /tests/unit | |
parent | 06d61f5f235f4869bc251ebd1e1e768c56297636 (diff) | |
download | jquery-ui-088ef05142168de75d2afcbe447a5b44cb2d3673.tar.gz jquery-ui-088ef05142168de75d2afcbe447a5b44cb2d3673.zip |
Accordion: Renamed changestart and change events to beforeActivate and activate, respectively. Fixes #6840 - Accordion: Rename changestart event to beforeActivate. Fixes #6842 - Accordion: Rename change event to activate.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/accordion/accordion_deprecated.js | 90 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_events.js | 16 | ||||
-rw-r--r-- | tests/unit/testsuite.js | 12 |
3 files changed, 105 insertions, 13 deletions
diff --git a/tests/unit/accordion/accordion_deprecated.js b/tests/unit/accordion/accordion_deprecated.js index a0ca3f634..6f1c30562 100644 --- a/tests/unit/accordion/accordion_deprecated.js +++ b/tests/unit/accordion/accordion_deprecated.js @@ -221,4 +221,94 @@ test( "{ navigation: true, navigationFilter: content }", function() { state( ac, 0, 0, 1 ); }); + + + + +module( "accordion (deprecated) - changestart/change events", accordionSetupTeardown() ); + +test( "changestart", function() { + expect( 20 ); + var ac = $( "#list1" ).accordion({ + active: false, + collapsible: true + }); + var headers = ac.find( ".ui-accordion-header" ); + var content = ac.find( ".ui-accordion-content" ); + + ac.one( "accordionchangestart", function( event, ui ) { + equals( ui.oldHeader.size(), 0 ); + equals( ui.oldContent.size(), 0 ); + equals( ui.newHeader.size(), 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 0 ] ); + equals( ui.newContent.size(), 1 ); + strictEqual( ui.newContent[ 0 ], content[ 0 ] ); + }); + ac.accordion( "option", "active", 0 ); + + ac.one( "accordionchangestart", function( event, ui ) { + equals( ui.oldHeader.size(), 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); + equals( ui.oldContent.size(), 1 ); + strictEqual( ui.oldContent[ 0 ], content[ 0 ] ); + equals( ui.newHeader.size(), 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 1 ] ); + equals( ui.newContent.size(), 1 ); + strictEqual( ui.newContent[ 0 ], content[ 1 ] ); + }); + headers.eq( 1 ).click(); + + ac.one( "accordionchangestart", function( event, ui ) { + equals( ui.oldHeader.size(), 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); + equals( ui.oldContent.size(), 1 ); + strictEqual( ui.oldContent[ 0 ], content[ 1 ] ); + equals( ui.newHeader.size(), 0 ); + equals( ui.newContent.size(), 0 ); + }); + ac.accordion( "option", "active", false ); +}); + +test( "change", function() { + expect( 20 ); + var ac = $( "#list1" ).accordion({ + active: false, + collapsible: true + }); + var headers = ac.find( ".ui-accordion-header" ); + var content = ac.find( ".ui-accordion-content" ); + + ac.one( "accordionchange", function( event, ui ) { + equals( ui.oldHeader.size(), 0 ); + equals( ui.oldContent.size(), 0 ); + equals( ui.newHeader.size(), 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 0 ] ); + equals( ui.newContent.size(), 1 ); + strictEqual( ui.newContent[ 0 ], content[ 0 ] ); + }); + ac.accordion( "option", "active", 0 ); + + ac.one( "accordionchange", function( event, ui ) { + equals( ui.oldHeader.size(), 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); + equals( ui.oldContent.size(), 1 ); + strictEqual( ui.oldContent[ 0 ], content[ 0 ] ); + equals( ui.newHeader.size(), 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 1 ] ); + equals( ui.newContent.size(), 1 ); + strictEqual( ui.newContent[ 0 ], content[ 1 ] ); + }); + headers.eq( 1 ).click(); + + ac.one( "accordionchange", function( event, ui ) { + equals( ui.oldHeader.size(), 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); + equals( ui.oldContent.size(), 1 ); + strictEqual( ui.oldContent[ 0 ], content[ 1 ] ); + equals( ui.newHeader.size(), 0 ); + equals( ui.newContent.size(), 0 ); + }); + ac.accordion( "option", "active", false ); +}); + })(jQuery); diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index 463a277d8..fd7391387 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -2,7 +2,7 @@ module( "accordion: events", accordionSetupTeardown() ); -test( "changestart", function() { +test( "beforeActivate", function() { expect( 20 ); var ac = $( "#list1" ).accordion({ active: false, @@ -11,7 +11,7 @@ test( "changestart", function() { var headers = ac.find( ".ui-accordion-header" ); var content = ac.find( ".ui-accordion-content" ); - ac.one( "accordionchangestart", function( event, ui ) { + ac.one( "accordionbeforeactivate", function( event, ui ) { equals( ui.oldHeader.size(), 0 ); equals( ui.oldContent.size(), 0 ); equals( ui.newHeader.size(), 1 ); @@ -21,7 +21,7 @@ test( "changestart", function() { }); ac.accordion( "option", "active", 0 ); - ac.one( "accordionchangestart", function( event, ui ) { + ac.one( "accordionbeforeactivate", function( event, ui ) { equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); equals( ui.oldContent.size(), 1 ); @@ -33,7 +33,7 @@ test( "changestart", function() { }); headers.eq( 1 ).click(); - ac.one( "accordionchangestart", function( event, ui ) { + ac.one( "accordionbeforeactivate", function( event, ui ) { equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); equals( ui.oldContent.size(), 1 ); @@ -44,7 +44,7 @@ test( "changestart", function() { ac.accordion( "option", "active", false ); }); -test( "change", function() { +test( "activate", function() { expect( 20 ); var ac = $( "#list1" ).accordion({ active: false, @@ -53,7 +53,7 @@ test( "change", function() { var headers = ac.find( ".ui-accordion-header" ); var content = ac.find( ".ui-accordion-content" ); - ac.one( "accordionchange", function( event, ui ) { + ac.one( "accordionactivate", function( event, ui ) { equals( ui.oldHeader.size(), 0 ); equals( ui.oldContent.size(), 0 ); equals( ui.newHeader.size(), 1 ); @@ -63,7 +63,7 @@ test( "change", function() { }); ac.accordion( "option", "active", 0 ); - ac.one( "accordionchange", function( event, ui ) { + ac.one( "accordionactivate", function( event, ui ) { equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); equals( ui.oldContent.size(), 1 ); @@ -75,7 +75,7 @@ test( "change", function() { }); headers.eq( 1 ).click(); - ac.one( "accordionchange", function( event, ui ) { + ac.one( "accordionactivate", function( event, ui ) { equals( ui.oldHeader.size(), 1 ); strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); equals( ui.oldContent.size(), 1 ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 0033182dc..9724a946f 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -34,12 +34,14 @@ var privateMethods = [ ]; function testWidgetOverrides( widget ) { - test( "$.widget overrides", function() { - $.each( privateMethods, function( i, method ) { - strictEqual( $.ui[ widget ].prototype[ method ], - $.Widget.prototype[ method ], "should not override " + method ); + if ( $.uiBackCompat === false ) { + test( "$.widget overrides", function() { + $.each( privateMethods, function( i, method ) { + strictEqual( $.ui[ widget ].prototype[ method ], + $.Widget.prototype[ method ], "should not override " + method ); + }); }); - }); + } } function testBasicUsage( widget ) { |