Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / input / setting-input-value-cancel-ime-composition.html
blob9aef5c9dd76e9828b7d30173a72ac8eb343f12bc
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title> Testcase for bug crbug.com/242715 </title>
5 <script src="../../resources/js-test.js"></script>
6 <script>
7 function runTest() {
8 description('This test ensures WebKit clears IME composition inside an input element \
9 when the value is programmatically set.');
11 var test = document.getElementById('test');
12 test.addEventListener('keyup', function(event) {
13 if (event.keyCode == 40)
14 test.value = 'henhao';
15 });
17 test.focus();
18 test.selectionStart = 0;
19 test.selectionEnd = 0;
20 textInputController.setMarkedText("nihao", 0, 5);
22 debug('nihao should marked from 0 to 5');
23 shouldBeTrue("textInputController.hasMarkedText()");
24 shouldBeEqualToString("textInputController.markedRange().toString()", "0,5");
26 test.value = '';
27 debug('text was removed so there should be no marked text');
28 shouldBeFalse("textInputController.hasMarkedText()");
30 textInputController.setMarkedText("nihao", 0, 5);
31 debug('nihao should marked from 0 to 5');
32 shouldBeTrue("textInputController.hasMarkedText()");
33 shouldBeEqualToString("textInputController.markedRange().toString()", "0,5");
35 eventSender.keyDown('downArrow');
37 debug('the text was changed so there should be no marked text');
38 shouldBeFalse("textInputController.hasMarkedText()");
40 document.body.removeChild(test);
41 isSuccessfullyParsed();
43 </script>
44 </body>
45 <body onload="runTest();">
46 <input id="test" type="text">
47 <div id="description"></div>
48 <div id="console"></div>
49 </body>
50 </html>