diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jquery.simulate.js | 2 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_core.js | 4 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_options.js | 8 | ||||
-rw-r--r-- | tests/unit/tooltip/tooltip_methods.js | 30 |
4 files changed, 37 insertions, 7 deletions
diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index e281e2fee..790c88c27 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -148,7 +148,7 @@ $.extend( $.simulate.prototype, { } // TODO: can we hook into core's logic? - if ( $.browser.msie || $.browser.opera ) { + if ( $.ui.ie || (({}).toString.call( window.opera ) === "[object Opera]") ) { // TODO: is charCode ever <0 ? Can we just use charCode || keyCode? event.keyCode = (options.charCode > 0) ? options.charCode : options.keyCode; event.charCode = undefined; diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index 17cefe157..e17b239e5 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -59,7 +59,7 @@ test('baseStructure', function() { var header, title, table, thead, week, panel, inl, child, inp = init('#inp').focus(), dp = $('#ui-datepicker-div'), - iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7); + iframe = ($.ui.ie6); ok(dp.is(':visible'), 'Structure - datepicker visible'); ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left'); ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month'); @@ -186,7 +186,7 @@ test('customStructure', function() { inp = init('#inp', $.datepicker.regional.he); inp.data('showButtonPanel.datepicker',true); inp.focus(); - iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7); + iframe = ($.ui.ie6); ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left'); header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division'); diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index 5a90ff895..1b468f2b6 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -7,7 +7,7 @@ var disabled = TestHelpers.tabs.disabled, module( "tabs: options" ); test( "{ active: default }", function() { - expect( 4 ); + expect( 6 ); var element = $( "#tabs1" ).tabs(); equal( element.tabs( "option", "active" ), 0, "should be 0 by default" ); @@ -19,6 +19,12 @@ test( "{ active: default }", function() { equal( element.tabs( "option", "active" ), 2, "should be 2 based on URL" ); state( element, 0, 0, 1 ); element.tabs( "destroy" ); + + location.hash = "#custom-id"; + element = $( "#tabs2" ).tabs(); + equal( element.tabs( "option", "active" ), 3, "should be 3 based on URL" ); + state( element, 0, 0, 0, 1, 0 ); + element.tabs( "destroy" ); location.hash = "#"; }); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 0af1e06e9..c846d216c 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -3,13 +3,20 @@ module( "tooltip: methods" ); test( "destroy", function() { - expect( 2 ); + expect( 3 ); + var element = $( "#tooltipped1" ); + domEqual( "#tooltipped1", function() { - $( "#tooltipped1" ).tooltip().tooltip( "destroy" ); + element.tooltip().tooltip( "destroy" ); }); // make sure that open tooltips are removed on destroy - $( "#tooltipped1" ).tooltip().tooltip( "open" ).tooltip( "destroy" ); + domEqual( "#tooltipped1", function() { + element + .tooltip() + .tooltip( "open", $.Event( "mouseover", { target: element[0] }) ) + .tooltip( "destroy" ); + }); equal( $( ".ui-tooltip" ).length, 0 ); }); @@ -29,6 +36,23 @@ test( "open/close", function() { $.fx.off = false; }); +// #8626 - Calling open() without an event +test( "open/close with tracking", function() { + expect( 3 ); + $.fx.off = true; + var tooltip, + element = $( "#tooltipped1" ).tooltip({ track: true }); + equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" ); + + element.tooltip( "open" ); + tooltip = $( "#" + element.data( "ui-tooltip-id" ) ); + ok( tooltip.is( ":visible" ) ); + + element.tooltip( "close" ); + ok( tooltip.is( ":hidden" ) ); + $.fx.off = false; +}); + test( "enable/disable", function() { expect( 7 ); $.fx.off = true; |