jquery-mobile/tests/unit/dialog/dialog_events.js

39 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

/*
* mobile dialog unit tests
*/
2011-08-11 00:10:31 +00:00
(function($) {
module( "jquery.mobile.dialog.js" );
2011-08-11 00:10:31 +00:00
asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
expect( 6 );
$.testHelper.pageSequence([
2011-08-11 00:10:31 +00:00
function() {
//bring up the dialog
2011-08-11 00:10:31 +00:00
$( "#foo-dialog-link" ).click();
},
2011-08-11 00:10:31 +00:00
function() {
var fooDialog = $( "#foo-dialog" );
// make sure the dialog came up
ok( /&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open" );
// Assert dialog theme inheritance (issue 1375):
2011-08-11 00:10:31 +00:00
ok( fooDialog.hasClass( "ui-body-b" ), "Expected explicit theme ui-body-b" );
ok( fooDialog.find( ":jqmData(role=header)" ).hasClass( "ui-bar-a" ), "Expected header to inherit from $.mobile.page.prototype.options.headerTheme" );
ok( fooDialog.find( ":jqmData(role=content)" ).hasClass( "ui-body-d" ), "Expect content to inherit from $.mobile.page.prototype.options.contentTheme" );
ok( fooDialog.find( ":jqmData(role=footer)" ).hasClass( "ui-bar-a" ), "Expected footer to inherit from $.mobile.page.prototype.options.footerTheme" );
// close the dialog
2011-08-11 00:10:31 +00:00
$( ".ui-dialog" ).dialog( "close" );
},
2011-08-11 00:10:31 +00:00
function() {
ok( !/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash" );
start();
}
]);
});
2011-08-11 00:10:31 +00:00
})( jQuery );