Selectmenu: small fixes for lint tests

This commit is contained in:
Felix Nagel 2012-05-24 18:54:47 +02:00
parent 7345e43048
commit 37a80477c0
4 changed files with 21 additions and 14 deletions

View File

@ -3,13 +3,14 @@
module( "selectmenu: core" );
test("accessibility", function () {
var element = $('#speed').selectmenu(),
var links,
element = $('#speed').selectmenu(),
button = element.selectmenu("widget"),
menu = element.selectmenu("menuWidget"),
selected = element.find("option:selected");
button.simulate( "focus" );
var links = menu.find("li.ui-menu-item a");
links = menu.find("li.ui-menu-item a");
expect(12 + links.length * 2);
@ -46,13 +47,14 @@ $.each([
test("state synchronization - " + settings.type, function () {
expect(8);
var element = $(settings.selector).selectmenu(),
var links,
element = $(settings.selector).selectmenu(),
button = element.selectmenu("widget"),
menu = element.selectmenu("menuWidget"),
selected = element.find("option:selected");
button.simulate( "focus" )
var links = menu.find("li.ui-menu-item a");
button.simulate( "focus" );
links = menu.find("li.ui-menu-item a");
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( menu.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "after keydown menu aria-activedescendant" );

View File

@ -46,7 +46,9 @@ test("close", function () {
test("focus", function () {
expect(4);
var counter = 0;
var counter = 0,
button,
menu;
this.element.selectmenu({
focus: function (event, ui) {
@ -60,8 +62,8 @@ test("focus", function () {
}
});
var button = this.element.selectmenu("widget").parent(),
menu = this.element.selectmenu("menuWidget").parent();
button = this.element.selectmenu("widget").parent();
menu = this.element.selectmenu("menuWidget").parent();
button.find("a").simulate( "focus" ).simulate( "click" );
menu.find(".ui-menu-item").simulate("mouseover");

View File

@ -89,7 +89,8 @@ test("refresh - disabled select", function () {
test("refresh - disabled option", function () {
expect(1);
var element = $('#speed').selectmenu(),
var disabledItem,
element = $('#speed').selectmenu(),
button = element.selectmenu("widget").parent(),
menu = element.selectmenu("menuWidget").parent();
@ -97,14 +98,16 @@ test("refresh - disabled option", function () {
element.find("option").eq(2).attr("disabled", "disabled");
element.selectmenu("refresh");
var disabledItem = menu.find("li").not(".ui-selectmenu-optgroup").eq(2);
disabledItem = menu.find("li").not(".ui-selectmenu-optgroup").eq(2);
ok( disabledItem.hasClass("ui-state-disabled"), "class" );
});
test("refresh - disabled optgroup", function () {
var element = $('#files').selectmenu(),
var i,
item,
element = $('#files').selectmenu(),
button = element.selectmenu("widget").parent(),
menu = element.selectmenu("menuWidget").parent(),
originalDisabledOptgroup = element.find("optgroup").first(),
@ -115,11 +118,11 @@ test("refresh - disabled optgroup", function () {
originalDisabledOptgroup.attr("disabled", "disabled");
element.selectmenu("refresh");
var item = menu.find("li.ui-selectmenu-optgroup").first();
item = menu.find("li.ui-selectmenu-optgroup").first();
ok( item.hasClass("ui-state-disabled"), "class" );
equal( menu.find("li").not(".ui-selectmenu-optgroup").filter(".ui-state-disabled").length, originalDisabledOptions.length, "disabled options" );
for ( var i = 0; i < originalDisabledOptions.length; i++ ) {
for ( i = 0; i < originalDisabledOptions.length; i++ ) {
item = item.next("li");
ok( item.hasClass("ui-state-disabled"), "item #" + i + ": class" );
}

View File

@ -5,7 +5,7 @@ module("selectmenu: options");
test("appendTo another element", function () {
expect(2);
element = $("#speed").selectmenu();
var element = $("#speed").selectmenu();
ok(element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector");
ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element");