mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Selectmenu: Refactor appendTo option tests
This commit is contained in:
parent
fa99e23d18
commit
0c754f9d9e
@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
module( "selectmenu: options" );
|
module( "selectmenu: options" );
|
||||||
|
|
||||||
test( "appendTo another element", function () {
|
test( "appendTo: null", function() {
|
||||||
expect( 9 );
|
expect( 1 );
|
||||||
|
var element = $( "#speed" ).selectmenu();
|
||||||
var detached = $( "<div>" ),
|
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],document.body,
|
||||||
element = $( "#speed" ).selectmenu();
|
"defaults to body" );
|
||||||
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body, "defaults to body" );
|
|
||||||
element.selectmenu( "destroy" );
|
element.selectmenu( "destroy" );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "appendTo: explicit", function() {
|
||||||
|
expect( 6 );
|
||||||
|
var detached = $( "<div>" ),
|
||||||
|
element = $( "#speed" );
|
||||||
|
|
||||||
element.selectmenu({
|
element.selectmenu({
|
||||||
appendTo: ".selectmenu-wrap"
|
appendTo: ".selectmenu-wrap"
|
||||||
@ -17,17 +22,6 @@ test( "appendTo another element", function () {
|
|||||||
equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
|
equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
|
||||||
element.selectmenu( "destroy" );
|
element.selectmenu( "destroy" );
|
||||||
|
|
||||||
$( "#selectmenu-wrap2" ).addClass( "ui-front" );
|
|
||||||
element.selectmenu();
|
|
||||||
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
|
|
||||||
element.selectmenu( "destroy" );
|
|
||||||
|
|
||||||
element.selectmenu({
|
|
||||||
appendTo: $()
|
|
||||||
});
|
|
||||||
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
|
|
||||||
$( "#selectmenu-wrap2" ).removeClass( "ui-front" );
|
|
||||||
|
|
||||||
element.selectmenu().selectmenu( "option", "appendTo", "#selectmenu-wrap1" );
|
element.selectmenu().selectmenu( "option", "appendTo", "#selectmenu-wrap1" );
|
||||||
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
|
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
|
||||||
element.selectmenu( "destroy" );
|
element.selectmenu( "destroy" );
|
||||||
@ -49,6 +43,23 @@ test( "appendTo another element", function () {
|
|||||||
element.selectmenu( "destroy" );
|
element.selectmenu( "destroy" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "appendTo: ui-front", function() {
|
||||||
|
expect( 2 );
|
||||||
|
var element = $( "#speed" );
|
||||||
|
|
||||||
|
$( "#selectmenu-wrap2" ).addClass( "ui-front" );
|
||||||
|
element.selectmenu();
|
||||||
|
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
|
||||||
|
$( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
|
||||||
|
element.selectmenu( "destroy" );
|
||||||
|
|
||||||
|
element.selectmenu({
|
||||||
|
appendTo: $()
|
||||||
|
});
|
||||||
|
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
|
||||||
|
$( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
test( "CSS styles", function () {
|
test( "CSS styles", function () {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
Loading…
Reference in New Issue
Block a user