added failing test for on screen custom select menu rendering

This commit is contained in:
John Bender 2011-03-12 22:52:44 -08:00
parent 129b586666
commit e3000e2dec
3 changed files with 44 additions and 2 deletions

View file

@ -14,6 +14,7 @@
<script type="text/javascript" src="../../../external/qunit.js"></script>
<script type="text/javascript" src="select_events.js"></script>
<script type="text/javascript" src="select_core.js"></script>
</head>
<body>
@ -106,5 +107,25 @@
<option value="WY">Wyoming</option>
</select>
</div>
<div data-role="fieldcontain" id="select-offscreen-container">
<style>
/* keep the select small and close to the screen border to test rendering */
#select-offscreen-container {
width: 100px;
position: absolute;
left: 0px;
top: 0px;
}
</style>
<select name="select-choice-few" id="select-offscreen">
<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>
</div>
</body>
</html>

View file

@ -0,0 +1,21 @@
/*
* mobile select unit tests
*/
(function($){
var libName = "jquery.mobile.forms.select.js";
module(libName);
asyncTest( "custom select menu always renders screen from the left", function(){
expect( 2 );
var select = $("ul#select-offscreen-menu");
$('#select-offscreen-container a').trigger($.support.touch ? "touchend" : "mouseup");
setTimeout(function(){
ok(select.offset().left >= 30);
start();
}, 1000);
});
})(jQuery);

View file

@ -45,7 +45,7 @@
stop();
});
test( "selects marked with data-native-menu=true should use a div as their button", function(){
same($("#select-choice-native-container div.ui-btn").length, 1);
});
@ -53,7 +53,7 @@
test( "selects marked with data-native-menu=true should not have a custom menu", function(){
same($("#select-choice-native-container ul").length, 0);
});
test( "selects marked with data-native-menu=true should sit inside the button", function(){
same($("#select-choice-native-container div.ui-btn select").length, 1);
});