mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: added basic method unit tests
This commit is contained in:
parent
e79700eb28
commit
d97b6db2cd
@ -47,9 +47,32 @@
|
||||
<option value="Faster">Faster</option>
|
||||
</select>
|
||||
|
||||
<label for="number">Select a number:</label>
|
||||
<select name="number" id="number">
|
||||
<option value="1">1</option>
|
||||
<option value="2" selected="selected">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
</select>
|
||||
|
||||
<label for="files">Select a file:</label>
|
||||
<select name="files" id="files">
|
||||
<optgroup disabled="disabled" label="Scripts">
|
||||
<optgroup label="Scripts">
|
||||
<option value="jquery">jQuery.js</option>
|
||||
<option value="jqueryui">ui.jQuery.js</option>
|
||||
</optgroup>
|
||||
|
@ -28,13 +28,11 @@ test("accessibility", function () {
|
||||
$.each([
|
||||
{
|
||||
type: "default",
|
||||
selector: "#speed",
|
||||
valueMethod: "val"
|
||||
selector: "#speed"
|
||||
},
|
||||
{
|
||||
type: "optgroups",
|
||||
selector: "#files",
|
||||
valueMethod: "text"
|
||||
selector: "#files"
|
||||
}
|
||||
], function( i, settings ) {
|
||||
test("state synchronization - " + settings.type, function () {
|
||||
|
@ -9,4 +9,65 @@ test( "destroy", function() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
test( "open", function() {
|
||||
expect( 2 );
|
||||
|
||||
var element = $("#speed").selectmenu();
|
||||
var widget = element.selectmenu("widget");
|
||||
var button = widget.filter(".ui-selectmenu-button");
|
||||
var menu = widget.filter(".ui-selectmenu-menu");
|
||||
|
||||
element.selectmenu("open");
|
||||
ok( menu.is( ":visible" ), "menu visible" );
|
||||
equals( menu.find("ul").attr("aria-hidden"), "false", "menu aria-disabled" );
|
||||
});
|
||||
|
||||
|
||||
test( "close", function() {
|
||||
expect( 2 );
|
||||
|
||||
var element = $("#speed").selectmenu();
|
||||
var widget = element.selectmenu("widget");
|
||||
var button = widget.filter(".ui-selectmenu-button");
|
||||
var menu = widget.filter(".ui-selectmenu-menu");
|
||||
|
||||
element.selectmenu("open");
|
||||
element.selectmenu("close");
|
||||
ok( menu.is( ":hidden" ), "menu hidden" );
|
||||
equals( menu.find("ul").attr("aria-hidden"), "true", "menu aria-disabled" );
|
||||
});
|
||||
|
||||
|
||||
$.each([
|
||||
{
|
||||
type: "default",
|
||||
selector: "#speed",
|
||||
options: null
|
||||
},
|
||||
{
|
||||
type: "pop-up",
|
||||
selector: "#number",
|
||||
options: {
|
||||
dropdown: false
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "optgroups",
|
||||
selector: "#files",
|
||||
options: null
|
||||
}
|
||||
], function( i, settings ) {
|
||||
test("refresh - " + settings.type, function () {
|
||||
// expect(6);
|
||||
var element = $(settings.selector).selectmenu(settings.options);
|
||||
var widget = element.selectmenu("widget");
|
||||
var button = widget.filter(".ui-selectmenu-button");
|
||||
var menu = widget.filter(".ui-selectmenu-menu");
|
||||
|
||||
element.selectmenu("refresh");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
})( jQuery );
|
||||
|
Loading…
Reference in New Issue
Block a user