2 * mobile button unit tests
5 $.mobile.page.prototype.options.keepNative = "button.should-be-native";
7 test( "button elements in the keepNative set shouldn't be enhanced", function() {
8 same( $("button.should-be-native").siblings("div.ui-slider").length, 0 );
11 test( "button elements should be enhanced", function() {
12 ok( $("#enhanced").hasClass( "ui-btn-hidden" ) );
15 test( "button markup text value should be changed on refresh", function() {
16 var textValueButton = $("#text"), valueButton = $("#value");
18 // the value shouldn't change unless it's been altered
19 textValueButton.button( 'refresh' );
20 same( textValueButton.siblings().text(), "foo" );
22 // use the text where it's provided
23 same( textValueButton.siblings().text(), "foo" );
24 textValueButton.text( "bar" ).button( 'refresh' );
25 same( textValueButton.siblings().text(), "bar" );
27 // use the val if it's provided where the text isn't
28 same( valueButton.siblings().text(), "foo" );
29 valueButton.val( "bar" ).button( 'refresh' );
30 same( valueButton.siblings().text(), "bar" );
32 // prefer the text to the value
33 textValueButton.text( "bar" ).val( "baz" ).button( 'refresh' );
34 same( textValueButton.siblings().text(), "bar" );
38 test( "verify the button placeholder is added many times", function() {
39 var $form = $( "#hidden-element-addition-form" ), count = 3;
42 for( var x = 0; x < count; x++ ) {
43 $( "#hidden-element-addition" ).trigger( "vclick" );
44 same( $form.find( "input[type='hidden']" ).length, 1, "hidden form input should be added" );
46 $form.trigger( "submit" );
47 same( $form.find( "[type='hidden']" ).length, 0, "hidden form input is removed" );