summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/text/input-set-composition-scroll.html
blob: b369cf084fe6ae15a05894ee3fd471d2ba8dc36c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<p>This tests whether an input field scrolls to the end of the new composition when setComposition is called.</p>
<input size="10"/>
<pre id="log">
</pre>
<script>
function log(s) {
    document.getElementById('log').appendChild(document.createTextNode(s + "\n"));
}

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

var input = document.querySelector('input');
input.focus();
textInputController.setComposition('longsinglewordstringcomposition');
var maxScrollLeft = input.scrollWidth - input.clientWidth;
if (maxScrollLeft - input.scrollLeft < 5)
    log("SUCCESS: input has scrolled to the end of the composition");
else
    log("FAILED: input has not scrolled to the end of the composition. scrollLeft=" + input.scrollLeft);
</script>