Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / text / chromium-mac-duplicate-ime-composition.html
blobc53187c3220a76af8c70e3d7669a07c15bdff5f9
1 <html>
2 <head>
3 <script src="../../resources/run-after-layout-and-paint.js"></script>
4 <script>
5 function check(expect, actual) {
6 var console = document.getElementById('console');
7 var div = document.createElement('div');
8 div.innerHTML = expect == actual ? 'PASS' : 'FAIL';
9 div.innerHTML += ' expects = "' + expect + '", actual = "' + actual + '"';
10 console.appendChild(div);
13 function doTest() {
14 if (!window.testRunner)
15 return;
16 testRunner.dumpAsText();
17 testRunner.waitUntilDone();
18 var textarea = document.getElementById('textarea');
19 var consoleElement = document.getElementById('console');
20 textarea.addEventListener('keydown', function (e) {
21 textarea.style['overflow'] = 'hidden';
22 });
23 runAfterLayoutAndPaint(function() {
24 textarea.focus();
25 if (textInputController.setComposition) {
26 // Emulates start input method conversion.
27 textInputController.setComposition('first');
28 // Then, emulates change of the composition text of the input method.
29 textInputController.setComposition('second');
30 // Checks whether the textarea does not contain the first composition.
31 check('second', textarea.value);
33 testRunner.notifyDone();
34 });
36 </script>
37 </head>
38 <body onload="doTest()">
39 <p>This page ensures that the composition text of an input method does not insert into the textarea when the composition text is updated but is not committed. The bug, reported in <a href="https://bugs.webkit.org/show_bug.cgi?id=46868">the issue 46868</a>, should not occur here. When DRT tests this page, it will emulate changing composition text from "first" to "second". After that, the value of the textarea should be "second" and should not be "secondfirst". </p>
40 <p>For manual test, input text into the following textarea by using an input method. The composition text which is not committed should not be inserted into the textarea.</p>
41 <textarea id="textarea"></textarea>
42 <div id="console"></div>
43 </body>
44 </html>