From e3000e2decde5ba795584678f26755a42663bd3c Mon Sep 17 00:00:00 2001 From: John Bender Date: Sat, 12 Mar 2011 22:52:44 -0800 Subject: [PATCH] added failing test for on screen custom select menu rendering --- tests/unit/select/index.html | 21 +++++++++++++++++++++ tests/unit/select/select_core.js | 21 +++++++++++++++++++++ tests/unit/select/select_events.js | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/unit/select/select_core.js diff --git a/tests/unit/select/index.html b/tests/unit/select/index.html index 7a052285..7a9d75b2 100644 --- a/tests/unit/select/index.html +++ b/tests/unit/select/index.html @@ -14,6 +14,7 @@ + @@ -106,5 +107,25 @@ + +
+ + + +
+ diff --git a/tests/unit/select/select_core.js b/tests/unit/select/select_core.js new file mode 100644 index 00000000..7af1a850 --- /dev/null +++ b/tests/unit/select/select_core.js @@ -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); \ No newline at end of file diff --git a/tests/unit/select/select_events.js b/tests/unit/select/select_events.js index fdcc2ee6..5de5d7be 100644 --- a/tests/unit/select/select_events.js +++ b/tests/unit/select/select_events.js @@ -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); });