Skip to content

Commit 911ff69

Browse files
committed
test for custom select dialog title update from dom
1 parent 5fce115 commit 911ff69

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

tests/unit/select/select_core.js

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,49 @@
336336

337337
$.mobile.page.prototype.options.keepNative = "select.should-be-native";
338338

339-
// not testing the positive case here since's it's obviously tested elsewhere
339+
// not testing the positive case here since's it's obviously tested elsewhere
340340
test( "select elements in the keepNative set shouldn't be enhanced", function() {
341-
ok( !$("#keep-native").parent().is("div.ui-btn") );
341+
ok( !$("#keep-native").parent().is("div.ui-btn") );
342+
});
343+
344+
asyncTest( "dialog size select title should match the label", function() {
345+
var $select = $( "#select-choice-many-1" ),
346+
$label = $select.parent().siblings( "label" ),
347+
$button = $select.siblings( "a" );
348+
349+
$.testHelper.pageSequence([
350+
function() {
351+
$button.click();
352+
},
353+
354+
function() {
355+
same($.mobile.activePage.find( ".ui-title" ).text(), $label.text());
356+
window.history.back();
357+
},
358+
359+
start
360+
]);
361+
});
362+
363+
asyncTest( "dialog size select title should match the label when changed after the dialog markup is added to the DOM", function() {
364+
var $select = $( "#select-choice-many-1" ),
365+
$label = $select.parent().siblings( "label" ),
366+
$button = $select.siblings( "a" );
367+
368+
$label.text( "foo" );
369+
370+
$.testHelper.pageSequence([
371+
function() {
372+
$label.text( "foo" );
373+
$button.click();
374+
},
375+
376+
function() {
377+
same($.mobile.activePage.find( ".ui-title" ).text(), $label.text());
378+
window.history.back();
379+
},
380+
381+
start
382+
]);
342383
});
343384
})(jQuery);

0 commit comments

Comments
 (0)