Files
firefox/mobile/android/tests/browser/robocop/robocop_input.html
T
Jim Chen 400b4398aa Bug 1051556 - Add test for re-flushing changes; r=esawin
This patch adds a test for triggering re-flushing IME changes to
testInputConnection, by ending a composition followed by setting the
value of the input field.
2015-12-12 10:18:43 -05:00

50 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Robocop Input</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p><input id="input" type="text"></p>
<p><input id="resetting-input" type="text"></p>
<script type="application/javascript;version=1.8" src="robocop_head.js"></script>
<script type="application/javascript;version=1.8">
let input = document.getElementById("input");
// An input that resets the editor on every input by resetting the value property.
let resetting_input = document.getElementById("resetting-input");
resetting_input.addEventListener('input', function () {
this.value = this.value;
});
let test = {
focus_input: function(val) {
input.value = val;
input.focus();
},
test_reflush_changes: function() {
let inputEditable = SpecialPowers.wrap(input).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement);
let inputIme = inputEditable.editor.QueryInterface(SpecialPowers.Ci.nsIEditorIMESupport);
do_check_true(inputIme.composing);
// Ending the composition then setting the input value triggers the bug.
inputIme.forceCompositionEnd();
input.value = "good";
},
focus_resetting_input: function(val) {
resetting_input.value = val;
resetting_input.focus();
},
finish_test: function() {
java.disconnect();
},
};
var java = new JavaBridge(test);
</script>
</body>
</html>