diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-05-03 06:31:12 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-05-03 06:31:12 -0400 |
commit | 45c727d75e411d0330027162646bbb26c4f671f1 (patch) | |
tree | 446b21bc5e016453d2ebe826cfad90a9401e626a /tests | |
parent | 5e44b3ce8851f62a38ce9211c6721e1050e2dabf (diff) | |
download | jquery-ui-45c727d75e411d0330027162646bbb26c4f671f1.tar.gz jquery-ui-45c727d75e411d0330027162646bbb26c4f671f1.zip |
Tabs: Fixed enabled and disabled methods. Fixes #7142 - Tabs: Deprecate enable and disable events.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/tabs/tabs_deprecated.js | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 25877e69c..15df3cd25 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -152,39 +152,37 @@ test('selected', function() { equals(el.tabs('option', 'selected'), 1, 'should select tab'); }); -module("tabs (deprecated): events"); +module( "tabs (deprecated): events" ); -test('enable', function() { - expect(4); +test( "enable", function() { + expect( 3 ); - var uiObj; - el = $('#tabs1').tabs({ + var element = $( "#tabs1" ).tabs({ disabled: [ 0, 1 ], - enable: function (event, ui) { - uiObj = ui; + enable: function ( event, ui ) { + equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equals( ui.index, 1, "ui.index" ); } }); - el.tabs('enable', 1); - ok(uiObj !== undefined, 'trigger callback'); - equals(uiObj.tab, $('a', el)[1], 'contain tab as DOM anchor element'); - equals(uiObj.panel, $('div', el)[1], 'contain panel as DOM div element'); - equals(uiObj.index, 1, 'contain index'); + element.tabs( "enable", 1 ); + // shouldn't trigger event + element.tabs( "enable", 2 ); }); -test('disable', function() { - expect(4); +test( "disable", function() { + expect( 3 ); - var uiObj; - el = $('#tabs1').tabs({ - disable: function (event, ui) { - uiObj = ui; + var element = $( "#tabs1" ).tabs({ + disable: function ( event, ui ) { + equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equals( ui.index, 1, "ui.index" ); } }); - el.tabs('disable', 1); - ok(uiObj !== undefined, 'trigger callback'); - equals(uiObj.tab, $('a', el)[1], 'contain tab as DOM anchor element'); - equals(uiObj.panel, $('div', el)[1], 'contain panel as DOM div element'); - equals(uiObj.index, 1, 'contain index'); + element.tabs( "disable", 1 ); + // shouldn't trigger event + element.tabs( "disable", 1 ); }); test('show', function() { |