add test to confirm that a document containing only a dialog with no pages will load the dialog as a page

This commit is contained in:
John Bender 2012-01-13 10:54:09 -08:00
parent 24b01c7268
commit 2f464dd865
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>jQuery Mobile Init Test Suite</title>
<script src="../../../js/jquery.js"></script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
<script src="../../../external/qunit.js"></script>
<script src="../../../external/requirejs/require.js"></script>
<script>
$.testHelper.asyncLoad([
[
"jquery.mobile.core",
],
[ "jquery.mobile.init" ],
[ "init_dialog.js" ]
]);
</script>
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../swarminject.js"></script>
</script>
</head>
<body>
<h1 id="qunit-header">jQuery Mobile Init Test Suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div data-nstest-role="dialog" id="foo">
<label for="select-choice-0" class="select">Shipping method:</label>
<select name="select-choice-0" id="select-choice-1">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
</select>
</div>
</body>
</html>

View file

@ -0,0 +1,16 @@
/*
* mobile init dialog tests
*/
(function($){
module( "jquery.mobile.init dialog load tests" );
// issue #3275
test( "A document containing no pages and a dialog role div will enhance the div as a page", function() {
ok( $("#foo").hasClass( "ui-page" ), "the div has the page class" );
// NOTE this will fail when/if we decide to render it as a dialog
ok( !$("#foo").hasClass( "ui-dialog-page" ), "the div does NOT have the dialog page class" );
});
//NOTE the opposite case is tested everyewhere else in the suite :D
})( jQuery );