Skip to content
Browse files

add test to confirm that a document containing only a dialog with no …

…pages will load the dialog as a page
  • Loading branch information...
1 parent 24b01c7 commit 2f464dd86586605f03a9f0315fb7dde936474496 @johnbender johnbender committed Jan 13, 2012
Showing with 61 additions and 0 deletions.
  1. +45 −0 tests/unit/init/dialog-load-test.html
  2. +16 −0 tests/unit/init/init_dialog.js
View
45 tests/unit/init/dialog-load-test.html
@@ -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
16 tests/unit/init/init_dialog.js
@@ -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 );

0 comments on commit 2f464dd

Please sign in to comment.
Something went wrong with that request. Please try again.