aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-05-09 17:01:11 -0400
committerScott González <scott.gonzalez@gmail.com>2011-05-09 17:01:11 -0400
commitea01e7fc50bb9480ee92dd3989dbdeb89cb71562 (patch)
treeeb26921ae7a0192644d4aa1cb48a4bbbb19f8981 /tests
parentf53d11785339543de7878add5ff25476246fa0b8 (diff)
downloadjquery-ui-ea01e7fc50bb9480ee92dd3989dbdeb89cb71562.tar.gz
jquery-ui-ea01e7fc50bb9480ee92dd3989dbdeb89cb71562.zip
Tabs: Added tests for event option.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/tabs/tabs_options.js51
1 files changed, 49 insertions, 2 deletions
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index 691186276..7e2d9baf5 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -149,8 +149,55 @@ test('disabled', function() {
same(el.tabs('option', 'disabled'), false, "should not disable any tab"); // ...
});
-test('event', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "{ event: null }", function() {
+ expect( 5 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: null
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.tabs( "option", "active", 1 );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+});
+
+test( "{ event: custom }", function() {
+ expect( 11 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: "custom1 custom2"
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "event", "custom3" );
+
+ // ensure old event handlers are unbound
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
});
test('fx', function() {