summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/text-iterator/findString-restarts-at-last-position.html
blob: 0d7eff5e9663d585f012d19cdb815f216ff8b17d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<script src=../../resources/js-test.js language="javascript" type="text/javascript"></script>
<title>Testing that searching for text restarts at the last active match.</title>
</head>
<body>
    <div id="container">
        Failure: If the second search ends up finding the text in this line we didn't restart the search from the last active match: last_step.<br />
        Start: The first search should match this word: first_step.<br />
        Success: The second search should match this word: last_step. Subsequent searches should fail.
    </div>
<pre id="console" style="visibility: hidden;"></pre>
<script>
function log(message)
{
    document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}

if (!window.testRunner)
    testFailed('This test requires the testRunner object');
else {
    shouldBeTrue('testRunner.findString("first_", [])');
    shouldBeTrue('testRunner.findString("first_step", ["StartInSelection"])');
    shouldBeTrue('testRunner.findString("last_step", [])');
    shouldBeFalse('testRunner.findString("last_step", [])');
    shouldBeTrue('testRunner.findString("last_step", ["WrapAround"])');
}

document.getElementById("console").style.removeProperty("visibility");

var successfullyParsed = true;
</script>
</body>
</html>