Skip to content

Commit e83a89d

Browse files
committed
Dev: Remove *_tickets.js test files and move the associated tests to the proper locations.
1 parent d4551bc commit e83a89d

File tree

10 files changed

+242
-267
lines changed

10 files changed

+242
-267
lines changed

tests/unit/button/button_core.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,60 @@ if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) {
113113
});
114114
}
115115

116+
test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
117+
expect( 5 );
118+
var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
119+
group.find( "input[type=checkbox]" ).button();
120+
ok( group.find( "label" ).is( ".ui-button" ) );
121+
122+
group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
123+
group.filter( "input[type=checkbox]" ).button();
124+
ok( group.filter( "label" ).is( ".ui-button" ) );
125+
126+
group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
127+
group.find( "input[type=checkbox]" ).button();
128+
ok( group.filter( "label" ).is( ".ui-button" ) );
129+
130+
group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
131+
group.find( "input[type=checkbox]" ).button();
132+
ok( group.find( "label" ).is( ".ui-button" ) );
133+
134+
group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
135+
group.filter( "input[type=checkbox]" ).button();
136+
ok( group.find( "label" ).is( ".ui-button" ) );
137+
});
138+
139+
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
140+
expect( 2 );
141+
$( "#radio01" ).next().andSelf().hide();
142+
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
143+
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
144+
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
145+
});
146+
147+
test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
148+
expect( 3 );
149+
$( "#radio0" ).hide();
150+
var set = $( "#radio0" ).buttonset();
151+
ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
152+
ok( set.find( "label:eq(1)" ).is( ".ui-button" ) );
153+
ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
154+
});
155+
156+
test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
157+
expect( 2 );
158+
var check = $( "#check" ).button(),
159+
label = $( "label[for='check']" );
160+
ok( !label.is( ".ui-state-focus" ) );
161+
check.focus();
162+
ok( label.is( ".ui-state-focus" ) );
163+
});
164+
165+
test( "#7534 - Button label selector works for ids with \":\"", function() {
166+
expect( 1 );
167+
var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
168+
group.find( "input" ).button();
169+
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
170+
});
171+
116172
})(jQuery);

tests/unit/button/button_options.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,15 @@ test("icons", function() {
103103
$("#button").button("destroy");
104104
});
105105

106+
test( "#5295 - button does not remove hoverstate if disabled" , function() {
107+
expect( 1 );
108+
var btn = $("#button").button();
109+
btn.hover( function() {
110+
btn.button( "disable" );
111+
});
112+
btn.trigger( "mouseenter" );
113+
btn.trigger( "mouseleave" );
114+
ok( !btn.is( ".ui-state-hover") );
115+
});
116+
106117
})(jQuery);

tests/unit/button/button_tickets.js

Lines changed: 0 additions & 75 deletions
This file was deleted.

tests/unit/dialog/dialog_core.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ test( "focus tabbable", function() {
8080
}, 13);
8181
});
8282

83-
// #7960
84-
test( "resizable handles below modal overlays", function() {
83+
test( "#7960: resizable handles below modal overlays", function() {
8584
expect( 1 );
8685

8786
var resizable = $( "<div>" ).resizable(),
@@ -93,4 +92,33 @@ test( "resizable handles below modal overlays", function() {
9392
dialog.dialog( "destroy" );
9493
});
9594

95+
asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
96+
expect( 3 );
97+
98+
var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }),
99+
inputs = el.find( "input" ),
100+
widget = el.dialog( "widget" )[ 0 ];
101+
102+
function checkTab() {
103+
ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
104+
105+
// check shift tab
106+
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
107+
setTimeout( checkShiftTab, 2 );
108+
}
109+
110+
function checkShiftTab() {
111+
ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
112+
113+
el.remove();
114+
start();
115+
}
116+
117+
inputs.eq( 1 ).focus();
118+
equal( document.activeElement, inputs[1], "Focus set on second input" );
119+
inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
120+
121+
setTimeout( checkTab, 2 );
122+
});
123+
96124
})(jQuery);

tests/unit/dialog/dialog_events.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,18 @@ asyncTest("ensure dialog's container doesn't scroll on resize and focus", functi
341341
}, 500);
342342
});
343343

344+
test("#5184: isOpen in dialogclose event is true", function() {
345+
expect( 3 );
346+
347+
var el = $( "<div></div>" ).dialog({
348+
close: function() {
349+
ok( !el.dialog("isOpen"), "dialog is not open during close" );
350+
}
351+
});
352+
ok( el.dialog("isOpen"), "dialog is open after init" );
353+
el.dialog( "close" );
354+
ok( !el.dialog("isOpen"), "dialog is not open after close" );
355+
el.remove();
356+
});
357+
344358
})(jQuery);

tests/unit/dialog/dialog_methods.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,52 @@ test("open", function() {
137137
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible after open method called');
138138
});
139139

140+
// TODO merge this with the main destroy test
141+
test("#4980: Destroy should place element back in original DOM position", function(){
142+
expect( 2 );
143+
var container = $('<div id="container"><div id="modal">Content</div></div>'),
144+
modal = container.find('#modal');
145+
modal.dialog();
146+
ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
147+
modal.dialog('destroy');
148+
ok($.contains(container[0], modal[0]), 'dialog(destroy) should place element back in original DOM position');
149+
});
150+
151+
test("#6137: dialog('open') causes form elements to reset on IE7", function() {
152+
expect(2);
153+
154+
var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
155+
'<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
156+
157+
d1.find('#b').prop( "checked", true );
158+
equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
159+
160+
d1.dialog('open');
161+
equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
162+
163+
d1.remove();
164+
});
165+
166+
test("#5531: dialog width should be at least minWidth on creation", function () {
167+
expect( 4 );
168+
var el = $('<div></div>').dialog({
169+
width: 200,
170+
minWidth: 300
171+
});
172+
173+
equal(el.dialog('option', 'width'), 300, "width is minWidth");
174+
el.dialog('option', 'width', 200);
175+
equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
176+
el.dialog('option', 'width', 320);
177+
equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
178+
el.remove();
179+
180+
el = $('<div></div>').dialog({
181+
minWidth: 300
182+
});
183+
ok(el.dialog('option', 'width') >= 300, "width is at least 300");
184+
el.remove();
185+
186+
});
187+
140188
})(jQuery);

tests/unit/dialog/dialog_options.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,26 @@ test("width", function() {
478478
el.remove();
479479
});
480480

481+
test("#4826: setting resizable false toggles resizable on dialog", function() {
482+
expect(6);
483+
var i,
484+
el = $('<div></div>').dialog({ resizable: false });
485+
486+
TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
487+
for (i=0; i<2; i++) {
488+
el.dialog('close').dialog('open');
489+
TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
490+
}
491+
el.remove();
492+
493+
el = $('<div></div>').dialog({ resizable: true });
494+
TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
495+
for (i=0; i<2; i++) {
496+
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
497+
TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
498+
}
499+
el.remove();
500+
501+
});
502+
481503
})(jQuery);

0 commit comments

Comments
 (0)