Skip to content
Permalink
Browse files

Selectmenu: small fixes for lint tests

  • Loading branch information
fnagel committed May 24, 2012
1 parent 7345e43 commit 37a80477c0fbd272b91d9b3cf6bcdc7903655e79
@@ -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" );
@@ -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");
@@ -89,22 +89,25 @@ 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();

element.attr("disabled", "disabled");
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" );
}
@@ -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");

0 comments on commit 37a8047

Please sign in to comment.
You can’t perform that action at this time.