2010-01-20 14:00:14 +00:00
|
|
|
/*
|
|
|
|
* button_tickets.js
|
|
|
|
*/
|
2010-11-12 15:28:55 +00:00
|
|
|
(function( $ ) {
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2010-11-12 15:28:55 +00:00
|
|
|
module( "button: tickets" );
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2012-01-01 16:44:22 +00:00
|
|
|
test( "#5295 - button does not remove hoverstate if disabled" , function() {
|
|
|
|
expect( 1 );
|
|
|
|
var btn = $("#button").button();
|
|
|
|
btn.hover( function() {
|
|
|
|
btn.button( "disable" );
|
|
|
|
});
|
|
|
|
btn.trigger( "mouseenter" );
|
|
|
|
btn.trigger( "mouseleave" );
|
|
|
|
ok( !btn.is( ".ui-state-hover") );
|
|
|
|
});
|
|
|
|
|
2010-11-12 15:28:55 +00:00
|
|
|
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 2 );
|
2010-11-12 15:28:55 +00:00
|
|
|
$( "#radio01" ).next().andSelf().hide();
|
2012-05-21 16:02:28 +00:00
|
|
|
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
|
2010-11-12 15:28:55 +00:00
|
|
|
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
|
2010-08-18 14:13:57 +00:00
|
|
|
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
|
|
|
|
});
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2010-11-12 15:28:55 +00:00
|
|
|
test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 3 );
|
2010-11-12 15:28:55 +00:00
|
|
|
$( "#radio0" ).hide();
|
|
|
|
var set = $( "#radio0" ).buttonset();
|
|
|
|
ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
|
|
|
|
ok( set.find( "label:eq(1)" ).is( ".ui-button" ) );
|
|
|
|
ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
|
|
|
|
});
|
|
|
|
|
2011-05-26 15:28:17 +00:00
|
|
|
test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 2 );
|
2011-05-26 15:28:17 +00:00
|
|
|
var check = $( "#check" ).button(),
|
|
|
|
label = $( "label[for='check']" );
|
|
|
|
ok( !label.is( ".ui-state-focus" ) );
|
|
|
|
check.focus();
|
|
|
|
ok( label.is( ".ui-state-focus" ) );
|
|
|
|
});
|
|
|
|
|
2011-03-11 15:52:13 +00:00
|
|
|
test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 5 );
|
2011-08-04 01:43:52 +00:00
|
|
|
var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
|
2012-05-21 16:47:15 +00:00
|
|
|
group.find( "input[type=checkbox]" ).button();
|
2011-03-11 15:52:13 +00:00
|
|
|
ok( group.find( "label" ).is( ".ui-button" ) );
|
|
|
|
|
2011-08-04 01:43:52 +00:00
|
|
|
group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
|
2012-05-21 16:47:15 +00:00
|
|
|
group.filter( "input[type=checkbox]" ).button();
|
2011-03-11 15:52:13 +00:00
|
|
|
ok( group.filter( "label" ).is( ".ui-button" ) );
|
|
|
|
|
2011-08-04 01:43:52 +00:00
|
|
|
group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
|
2012-05-21 16:47:15 +00:00
|
|
|
group.find( "input[type=checkbox]" ).button();
|
2011-03-11 15:52:13 +00:00
|
|
|
ok( group.filter( "label" ).is( ".ui-button" ) );
|
|
|
|
|
2011-08-04 01:43:52 +00:00
|
|
|
group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
|
2012-05-21 16:47:15 +00:00
|
|
|
group.find( "input[type=checkbox]" ).button();
|
2011-03-11 15:52:13 +00:00
|
|
|
ok( group.find( "label" ).is( ".ui-button" ) );
|
|
|
|
|
2011-08-04 01:43:52 +00:00
|
|
|
group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
|
2012-05-21 16:47:15 +00:00
|
|
|
group.filter( "input[type=checkbox]" ).button();
|
2011-03-11 15:52:13 +00:00
|
|
|
ok( group.find( "label" ).is( ".ui-button" ) );
|
|
|
|
});
|
|
|
|
|
2011-08-04 03:16:34 +00:00
|
|
|
test( "#7534 - Button label selector works for ids with \":\"", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 1 );
|
2011-08-04 03:16:34 +00:00
|
|
|
var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
|
|
|
|
group.find( "input" ).button();
|
|
|
|
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
|
|
|
|
});
|
|
|
|
|
2012-10-16 17:20:55 +00:00
|
|
|
test( "#8237 - Anchor tags lose disabled state when refreshed", function() {
|
|
|
|
expect( 1 );
|
|
|
|
var element = $( "<a id='a8237'></a>" ).appendTo( "#qunit-fixture" );
|
|
|
|
|
|
|
|
element.button({ disabled: true }).button( "refresh" );
|
|
|
|
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" );
|
|
|
|
});
|
|
|
|
|
2010-11-12 15:28:55 +00:00
|
|
|
})( jQuery );
|