test that the text and val can update the parent button markup

This commit is contained in:
John Bender 2011-10-31 14:07:10 -07:00
parent a8202d240d
commit 70571119b7
2 changed files with 25 additions and 1 deletions

View file

@ -9,6 +9,28 @@
});
test( "button elements should be enhanced", function() {
ok( $("#enhanced").hasClass( "ui-btn-hidden" ) );
ok( $("#enhanced").hasClass( "ui-btn-hidden" ) );
});
test( "button markup text value should be changed on refresh", function() {
var textValueButton = $("#text"), valueButton = $("#value");
// the value shouldn't change unless it's been altered
textValueButton.button( 'refresh' );
same( textValueButton.siblings().text(), "foo" );
// use the text where it's provided
same( textValueButton.siblings().text(), "foo" );
textValueButton.text( "bar" ).button( 'refresh' );
same( textValueButton.siblings().text(), "bar" );
// use the val if it's provided where the text isn't
same( valueButton.siblings().text(), "foo" );
valueButton.val( "bar" ).button( 'refresh' );
same( valueButton.siblings().text(), "bar" );
// prefer the text to the value
textValueButton.text( "bar" ).val( "baz" ).button( 'refresh' );
same( textValueButton.siblings().text(), "bar" );
});
})( jQuery );

View file

@ -30,6 +30,8 @@
<div data-nstest-role="content" data-nstest-theme="p">
<button class="should-be-native">foo</button>
<button id="enhanced">bar</button>
<button id="text">foo</button>
<button id="value" value="foo"></button>
</div>
</div>
</body>