From 911ff69972da9e172aad41c8a79448935065dfd2 Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 18 Oct 2011 09:39:25 -0700 Subject: [PATCH] test for custom select dialog title update from dom --- tests/unit/select/select_core.js | 45 ++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/tests/unit/select/select_core.js b/tests/unit/select/select_core.js index 9dd5ddf2..3271000f 100644 --- a/tests/unit/select/select_core.js +++ b/tests/unit/select/select_core.js @@ -336,8 +336,49 @@ $.mobile.page.prototype.options.keepNative = "select.should-be-native"; - // not testing the positive case here since's it's obviously tested elsewhere + // not testing the positive case here since's it's obviously tested elsewhere test( "select elements in the keepNative set shouldn't be enhanced", function() { - ok( !$("#keep-native").parent().is("div.ui-btn") ); + ok( !$("#keep-native").parent().is("div.ui-btn") ); + }); + + asyncTest( "dialog size select title should match the label", function() { + var $select = $( "#select-choice-many-1" ), + $label = $select.parent().siblings( "label" ), + $button = $select.siblings( "a" ); + + $.testHelper.pageSequence([ + function() { + $button.click(); + }, + + function() { + same($.mobile.activePage.find( ".ui-title" ).text(), $label.text()); + window.history.back(); + }, + + start + ]); + }); + + asyncTest( "dialog size select title should match the label when changed after the dialog markup is added to the DOM", function() { + var $select = $( "#select-choice-many-1" ), + $label = $select.parent().siblings( "label" ), + $button = $select.siblings( "a" ); + + $label.text( "foo" ); + + $.testHelper.pageSequence([ + function() { + $label.text( "foo" ); + $button.click(); + }, + + function() { + same($.mobile.activePage.find( ".ui-title" ).text(), $label.text()); + window.history.back(); + }, + + start + ]); }); })(jQuery);