Added unit tests for dialog theme inheritance.

This commit is contained in:
BradBroulik 2011-08-05 17:49:47 -05:00
parent d5cf4fc29a
commit bf4db8dae1
2 changed files with 12 additions and 6 deletions

View file

@ -14,10 +14,10 @@
ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash");
// Assert dialog theme inheritance (issue 1375):
ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected theme ui-body-b');
ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-b'), 'Expected header theme inherited from parent ui-bar-b');
ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-b'), 'Expect content inheritance from dialog theme ui-body-b');
ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-c'), 'Expected footer theme ui-bar-c');
ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected explicit theme ui-body-b');
ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-a'), 'Expected header to inherit from $.mobile.page.prototype.options.headerTheme');
ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-d'), 'Expect content to inherit from $.mobile.page.prototype.options.contentTheme');
ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-a'), 'Expected footer to inherit from $.mobile.page.prototype.options.footerTheme');
// close the dialog
$(".ui-dialog").dialog("close");

View file

@ -6,6 +6,12 @@
<title>jQuery Mobile Dialog Test Suite</title>
<script src="../../../js/jquery.js"></script>
<script>
$(document).bind('mobileinit',function(){
// Expect content to inherit this theme when not explicitly set
$.mobile.page.prototype.options.contentTheme = "d";
});
</script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../../js/"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
@ -33,10 +39,10 @@
<div data-nstest-role="header" data-nstest-position="inline">
<h1>Dialog</h1>
</div>
<div data-nstest-role="content">
<div data-nstest-role="content" >
<a href="#" id="internal-link">foo</a>
</div>
<div data-nstest-role="footer" data-nstest-theme="c">
<div data-nstest-role="footer">
footer
</div>
</div>