mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-04 04:44:42 +00:00
test that the text and val can update the parent button markup
This commit is contained in:
parent
a8202d240d
commit
70571119b7
2 changed files with 25 additions and 1 deletions
|
|
@ -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 );
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue