chromium/third_party/blink/web_tests/editing/input/ime-composition-clearpreedit.html

<html>
<head>
<title></title>
</head>
<body>
<p>This tests that clearing a text compose doesn't leave the composed text behild in the text field</p>
<p>To test manually, enable an IME, input characters, clear the compose and see if the input field only contains the initial value</p>
<input id="test" type="text" value=""/>
<ul id="console"></ul>
<script language="javascript" type="text/javascript">
function log(str) {
   var li = document.createElement('li');
   li.appendChild(document.createTextNode(str));
   var console = document.getElementById('console');
   console.appendChild(li);
}

var test = document.getElementById('test');
test.focus();

if (window.testRunner) {
    testRunner.dumpAsText();

    // Compose text.
    textInputController.setMarkedText('5', 5, 1);
    textInputController.setMarkedText('6', 5, 1);
    textInputController.setMarkedText('7', 5, 1);

    // Verify that the input field contains the composed value
    log(test.value == "7" ? "SUCCESS COMPOSE" : "FAILED COMPOSE");

    textInputController.setMarkedText('', 0, 1);

    // Verify that the input field only contains its initial value
    log(test.value == "" ? "SUCCESS CLEAR" : "FAILED CLEAR");
}
</script>
</body>
</html>