From aad1146a65a33169a490378c542aafea79903341 Mon Sep 17 00:00:00 2001 From: John Bender Date: Wed, 10 Aug 2011 13:54:05 -0700 Subject: [PATCH] added tests to verify that custom menu items are highlighted when they are selected --- tests/unit/select/select_core.js | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/unit/select/select_core.js b/tests/unit/select/select_core.js index a7a7db8b..93f66d20 100644 --- a/tests/unit/select/select_core.js +++ b/tests/unit/select/select_core.js @@ -293,6 +293,40 @@ ], 1000); }); + asyncTest( "selected items are highlighted", function(){ + $.testHelper.sequence([ + function(){ + // bring up the smaller choice menu + ok($("#select-choice-few-container a").length > 0, "there is in fact a button in the page"); + $("#select-choice-few-container a").trigger("click"); + }, + + function(){ + var firstMenuChoice = $("#select-choice-few-menu li:first"); + ok( firstMenuChoice.hasClass( $.mobile.activeBtnClass ), + "default menu choice has the active button class" ); + + $("#select-choice-few-menu a:last").click(); + }, + + function(){ + // bring up the menu again + $("#select-choice-few-container a").trigger("click"); + }, + + function(){ + var lastMenuChoice = $("#select-choice-few-menu li:last"); + ok( lastMenuChoice.hasClass( $.mobile.activeBtnClass ), + "previously slected item has the active button class" ); + + // close the dialog + lastMenuChoice.find( "a" ).click(); + }, + + start + ], 1000); + }); + test( "enabling and disabling", function(){ var select = $( "select" ).first(), button;