});
}
+test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
+ expect( 5 );
+ var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
+ group.filter( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
+ group.filter( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+});
+
+test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
+ expect( 2 );
+ $( "#radio01" ).next().andSelf().hide();
+ var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
+ ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
+ ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
+});
+
+test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
+ expect( 3 );
+ $( "#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" ) );
+});
+
+test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
+ expect( 2 );
+ var check = $( "#check" ).button(),
+ label = $( "label[for='check']" );
+ ok( !label.is( ".ui-state-focus" ) );
+ check.focus();
+ ok( label.is( ".ui-state-focus" ) );
+});
+
+test( "#7534 - Button label selector works for ids with \":\"", function() {
+ expect( 1 );
+ 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 :" );
+});
+
})(jQuery);
$("#button").button("destroy");
});
+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") );
+});
+
})(jQuery);
+++ /dev/null
-/*
- * button_tickets.js
- */
-(function( $ ) {
-
-module( "button: tickets" );
-
-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") );
-});
-
-test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
- expect( 2 );
- $( "#radio01" ).next().andSelf().hide();
- var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
- ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
- ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
-});
-
-test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
- expect( 3 );
- $( "#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" ) );
-});
-
-test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
- expect( 2 );
- var check = $( "#check" ).button(),
- label = $( "label[for='check']" );
- ok( !label.is( ".ui-state-focus" ) );
- check.focus();
- ok( label.is( ".ui-state-focus" ) );
-});
-
-test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
- expect( 5 );
- var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
- group.filter( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
- group.filter( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-});
-
-test( "#7534 - Button label selector works for ids with \":\"", function() {
- expect( 1 );
- 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 :" );
-});
-
-})( jQuery );
}, 13);
});
-// #7960
-test( "resizable handles below modal overlays", function() {
+test( "#7960: resizable handles below modal overlays", function() {
expect( 1 );
var resizable = $( "<div>" ).resizable(),
dialog.dialog( "destroy" );
});
+asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
+ expect( 3 );
+
+ var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }),
+ inputs = el.find( "input" ),
+ widget = el.dialog( "widget" )[ 0 ];
+
+ function checkTab() {
+ ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
+
+ // check shift tab
+ $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
+ setTimeout( checkShiftTab, 2 );
+ }
+
+ function checkShiftTab() {
+ ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
+
+ el.remove();
+ start();
+ }
+
+ inputs.eq( 1 ).focus();
+ equal( document.activeElement, inputs[1], "Focus set on second input" );
+ inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
+
+ setTimeout( checkTab, 2 );
+});
+
})(jQuery);
}, 500);
});
+test("#5184: isOpen in dialogclose event is true", function() {
+ expect( 3 );
+
+ var el = $( "<div></div>" ).dialog({
+ close: function() {
+ ok( !el.dialog("isOpen"), "dialog is not open during close" );
+ }
+ });
+ ok( el.dialog("isOpen"), "dialog is open after init" );
+ el.dialog( "close" );
+ ok( !el.dialog("isOpen"), "dialog is not open after close" );
+ el.remove();
+});
+
})(jQuery);
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible after open method called');
});
+// TODO merge this with the main destroy test
+test("#4980: Destroy should place element back in original DOM position", function(){
+ expect( 2 );
+ var container = $('<div id="container"><div id="modal">Content</div></div>'),
+ modal = container.find('#modal');
+ modal.dialog();
+ ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
+ modal.dialog('destroy');
+ ok($.contains(container[0], modal[0]), 'dialog(destroy) should place element back in original DOM position');
+});
+
+test("#6137: dialog('open') causes form elements to reset on IE7", function() {
+ expect(2);
+
+ var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
+ '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
+
+ d1.find('#b').prop( "checked", true );
+ equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+
+ d1.dialog('open');
+ equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+
+ d1.remove();
+});
+
+test("#5531: dialog width should be at least minWidth on creation", function () {
+ expect( 4 );
+ var el = $('<div></div>').dialog({
+ width: 200,
+ minWidth: 300
+ });
+
+ equal(el.dialog('option', 'width'), 300, "width is minWidth");
+ el.dialog('option', 'width', 200);
+ equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
+ el.dialog('option', 'width', 320);
+ equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
+ el.remove();
+
+ el = $('<div></div>').dialog({
+ minWidth: 300
+ });
+ ok(el.dialog('option', 'width') >= 300, "width is at least 300");
+ el.remove();
+
+});
+
})(jQuery);
el.remove();
});
+test("#4826: setting resizable false toggles resizable on dialog", function() {
+ expect(6);
+ var i,
+ el = $('<div></div>').dialog({ resizable: false });
+
+ TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
+ for (i=0; i<2; i++) {
+ el.dialog('close').dialog('open');
+ TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
+ }
+ el.remove();
+
+ el = $('<div></div>').dialog({ resizable: true });
+ TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
+ for (i=0; i<2; i++) {
+ el.dialog('close').dialog('option', 'resizable', false).dialog('open');
+ TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
+ }
+ el.remove();
+
+});
+
})(jQuery);
+++ /dev/null
-/*
- * dialog_tickets.js
- */
-(function($) {
-
-module( "dialog: tickets" );
-
-asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
- expect( 3 );
-
- var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }),
- inputs = el.find( "input" ),
- widget = el.dialog( "widget" )[ 0 ];
-
- function checkTab() {
- ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
-
- // check shift tab
- $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
- setTimeout( checkShiftTab, 2 );
- }
-
- function checkShiftTab() {
- ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
-
- el.remove();
- start();
- }
-
- inputs.eq( 1 ).focus();
- equal( document.activeElement, inputs[1], "Focus set on second input" );
- inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
-
- setTimeout( checkTab, 2 );
-});
-
-test("#4826: setting resizable false toggles resizable on dialog", function() {
- expect(6);
- var i,
- el = $('<div></div>').dialog({ resizable: false });
-
- TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
- for (i=0; i<2; i++) {
- el.dialog('close').dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
- }
- el.remove();
-
- el = $('<div></div>').dialog({ resizable: true });
- TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
- for (i=0; i<2; i++) {
- el.dialog('close').dialog('option', 'resizable', false).dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
- }
- el.remove();
-
-});
-
-test("#5184: isOpen in dialogclose event is true", function() {
- expect( 3 );
-
- var el = $( "<div></div>" ).dialog({
- close: function() {
- ok( !el.dialog("isOpen"), "dialog is not open during close" );
- }
- });
- ok( el.dialog("isOpen"), "dialog is open after init" );
- el.dialog( "close" );
- ok( !el.dialog("isOpen"), "dialog is not open after close" );
- el.remove();
-});
-
-test("#5531: dialog width should be at least minWidth on creation", function () {
- expect( 4 );
- var el = $('<div></div>').dialog({
- width: 200,
- minWidth: 300
- });
-
- equal(el.dialog('option', 'width'), 300, "width is minWidth");
- el.dialog('option', 'width', 200);
- equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
- el.dialog('option', 'width', 320);
- equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
- el.remove();
-
- el = $('<div></div>').dialog({
- minWidth: 300
- });
- ok(el.dialog('option', 'width') >= 300, "width is at least 300");
- el.remove();
-
-});
-
-test("#6137: dialog('open') causes form elements to reset on IE7", function() {
- expect(2);
-
- var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
- '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
-
- d1.find('#b').prop( "checked", true );
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
-
- d1.dialog('open');
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
-
- d1.remove();
-});
-
-// TODO merge this with the main destroy test
-test("#4980: Destroy should place element back in original DOM position", function(){
- expect( 2 );
- var container = $('<div id="container"><div id="modal">Content</div></div>'),
- modal = container.find('#modal');
- modal.dialog();
- ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
- modal.dialog('destroy');
- ok($.contains(container[0], modal[0]), 'dialog(destroy) should place element back in original DOM position');
-});
-
-})(jQuery);
});
+test("#3019: Stop fires too early", function() {
+ expect(2);
+
+ var helper = null,
+ el = $("#sortable").sortable({
+ stop: function(event, ui) {
+ helper = ui.helper;
+ }
+ });
+
+ TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable');
+ equal(helper, null, "helper should be false");
+
+});
+
+test('#4752: link event firing on sortable with connect list', function () {
+ expect( 10 );
+
+ var fired = {},
+ hasFired = function (type) { return (type in fired) && (true === fired[type]); };
+
+ $('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');
+
+ $('#qunit-fixture ul').sortable({
+ connectWith: '#qunit-fixture ul',
+ change: function () {
+ fired.change = true;
+ },
+ receive: function () {
+ fired.receive = true;
+ },
+ remove: function () {
+ fired.remove = true;
+ }
+ });
+
+ $('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
+ fired.click = true;
+ });
+
+ $('#sortable li:eq(0)').simulate('click');
+ ok(!hasFired('change'), 'Click only, change event should not have fired');
+ ok(hasFired('click'), 'Click event should have fired');
+
+ // Drag an item within the first list
+ fired = {};
+ $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
+ ok(hasFired('change'), '40px drag, change event should have fired');
+ ok(!hasFired('receive'), 'Receive event should not have fired');
+ ok(!hasFired('remove'), 'Remove event should not have fired');
+ ok(!hasFired('click'), 'Click event should not have fired');
+
+ // Drag an item from the first list to the second, connected list
+ fired = {};
+ $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
+ ok(hasFired('change'), '150px drag, change event should have fired');
+ ok(hasFired('receive'), 'Receive event should have fired');
+ ok(hasFired('remove'), 'Remove event should have fired');
+ ok(!hasFired('click'), 'Click event should not have fired');
+});
+
/*
test("receive", function() {
ok(false, "missing test - untested code is broken code.");
+++ /dev/null
-/*
- * sortable_tickets.js
- */
-(function($) {
-
-module("sortable: tickets");
-
-test("#3019: Stop fires too early", function() {
- expect(2);
-
- var helper = null,
- el = $("#sortable").sortable({
- stop: function(event, ui) {
- helper = ui.helper;
- }
- });
-
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable');
- equal(helper, null, "helper should be false");
-
-});
-
-test('#4752: link event firing on sortable with connect list', function () {
- expect( 10 );
-
- var fired = {},
- hasFired = function (type) { return (type in fired) && (true === fired[type]); };
-
- $('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');
-
- $('#qunit-fixture ul').sortable({
- connectWith: '#qunit-fixture ul',
- change: function () {
- fired.change = true;
- },
- receive: function () {
- fired.receive = true;
- },
- remove: function () {
- fired.remove = true;
- }
- });
-
- $('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
- fired.click = true;
- });
-
- $('#sortable li:eq(0)').simulate('click');
- ok(!hasFired('change'), 'Click only, change event should not have fired');
- ok(hasFired('click'), 'Click event should have fired');
-
- // Drag an item within the first list
- fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
- ok(hasFired('change'), '40px drag, change event should have fired');
- ok(!hasFired('receive'), 'Receive event should not have fired');
- ok(!hasFired('remove'), 'Remove event should not have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
-
- // Drag an item from the first list to the second, connected list
- fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
- ok(hasFired('change'), '150px drag, change event should have fired');
- ok(hasFired('receive'), 'Receive event should have fired');
- ok(hasFired('remove'), 'Remove event should have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
-});
-
-})(jQuery);