mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-30 02:44:44 +00:00
tests for getEncodedText helper and issue #2547
This commit is contained in:
parent
ac0288a5ba
commit
d816fe1ec1
4 changed files with 31 additions and 0 deletions
|
|
@ -117,4 +117,9 @@
|
|||
$( "#parent" ).removeWithDependents();
|
||||
same($( "#parent, #dependent" ).length, 0);
|
||||
});
|
||||
|
||||
test( "$.fn.getEncodedText should return the encoded value where $.fn.text doesn't", function() {
|
||||
same( $("#encoded").text(), "foo>");
|
||||
same( $("#encoded").getEncodedText(), "foo>");
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
<div id="qunit-fixtures">
|
||||
<div id="parent"></div>
|
||||
<div id="dependent"></div>
|
||||
<div id="encoded">foo></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -343,6 +343,10 @@
|
|||
<select name="parent-themed" id="parent-themed" data-nstest-native-menu="false">
|
||||
<option value="-1">default</option>
|
||||
</select>
|
||||
|
||||
<select name="encoded-option" id="encoded-option" data-nstest-native-menu="false">
|
||||
<option><script>window.encodedValueIsDefined = true;</script></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
var libName = "jquery.mobile.forms.select.js",
|
||||
originalDefaultDialogTrans = $.mobile.defaultDialogTransition,
|
||||
originalDefTransitionHandler = $.mobile.defaultTransitionHandler,
|
||||
originalGetEncodedText = $.fn.getEncodedText,
|
||||
resetHash, closeDialog;
|
||||
|
||||
resetHash = function(timeout){
|
||||
|
|
@ -20,6 +21,9 @@
|
|||
teardown: function(){
|
||||
$.mobile.defaultDialogTransition = originalDefaultDialogTrans;
|
||||
$.mobile.defaultTransitionHandler = originalDefTransitionHandler;
|
||||
|
||||
$.fn.getEncodedText = originalGetEncodedText;
|
||||
window.encodedValueIsDefined = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -313,4 +317,21 @@
|
|||
.siblings( "a" )
|
||||
.hasClass("ui-btn-up-" + select.parents(":jqmData(role='page')").jqmData('theme')));
|
||||
});
|
||||
|
||||
// issue #2547
|
||||
test( "custom select list item links have encoded option text values", function() {
|
||||
$( "#encoded-option" ).data( 'selectmenu' )._buildList();
|
||||
same(window.encodedValueIsDefined, undefined);
|
||||
});
|
||||
|
||||
// issue #2547
|
||||
test( "custom select list item links have unencoded option text values when using vanilla $.fn.text", function() {
|
||||
// undo our changes, undone in teardown
|
||||
$.fn.getEncodedText = $.fn.text;
|
||||
|
||||
$( "#encoded-option" ).data( 'selectmenu' )._buildList();
|
||||
|
||||
same(window.encodedValueIsDefined, true);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Reference in a new issue