/*
 * mobile select unit tests
 */

(function($){
	module("jquery.mobile.forms.select native");

	test( "native menu selections alter the button text", function(){
		var select = $( "#native-select-choice-few" ), setAndCheck;

		setAndCheck = function(key){
      var text;

		  select.val( key ).selectmenu( 'refresh' );
		  text = select.find( "option[value='" + key + "']" ).text();
		  same( select.parent().find(".ui-btn-text").text(), text );
		};

    setAndCheck( 'rush' );
    setAndCheck( 'standard' );
	});

	asyncTest( "selecting a value removes the related buttons down state", function(){
		var select = $( "#native-select-choice-few" );

		$.testHelper.sequence([
			function() {
				// click the native menu parent button
				select.parent().trigger( 'vmousedown' );
			},

			function() {
				ok( select.parent().hasClass("ui-btn-down-c"), "button down class added" );
			},

			function() {
				// trigger a change on the select
				select.trigger( "change" );
			},

			function() {
				ok( !select.parent().hasClass("ui-btn-down-c"), "button down class removed" );
				start();
			}
		], 300);
	});

	// issue https://github.com/jquery/jquery-mobile/issues/2410
	test( "adding options and refreshing a native select defaults the text", function() {
		var select = $( "#native-refresh" ),
      button = select.siblings( '.ui-btn-inner' ),
      text = "foo";
    
    same(button.text(), "default");
    select.find( "option" ).remove(); //remove the loading message
    select.append('<option value="1">' + text + '</option>');
    select.selectmenu('refresh');
		same(button.text(), text);
	});
})(jQuery);
@@ -1376,13 +1376,9 @@
 o%22;%0A
-    
 %0A
+
     
@@ -1572,16 +1572,16 @@
 resh');%0A
-
 %09%09same(b
@@ -1605,16 +1605,275 @@
 t);%0A%09%7D);
+%0A%0A%09// issue 2424%0A%09test( %22native selects should provide open and close as a no-op%22, function() %7B%0A%09%09// exception will prevent test success if undef%0A%09%09$( %22#native-refresh%22 ).selectmenu( 'open' );%0A%09%09$( %22#native-refresh%22 ).selectmenu( 'close' );%0A%09%09ok( true );%0A%09%7D);
 %0A%7D)(jQue

test for open and close no-op