4 function doubleClickWord()
6 var start
= document
.getElementById("start");
8 var x
= start
.offsetLeft
+ 2;
9 var y
= start
.offsetTop
+ 10;
11 eventSender
.leapForward(1000);
12 eventSender
.mouseMoveTo(x
, y
);
13 eventSender
.mouseDown();
14 eventSender
.mouseUp();
15 eventSender
.leapForward(1);
16 eventSender
.mouseDown();
17 eventSender
.mouseUp();
18 eventSender
.leapForward(1000);
21 function logResult(result
)
23 document
.getElementById("result").innerHTML
+= result
+ "<br/>";
28 if (!window
.eventSender
|| !window
.testRunner
|| !window
.internals
)
31 testRunner
.dumpAsText();
33 runTest("mac", "a paragraph");
34 runTest("win", "paragra");
37 function runTest(behavior
, expectedText
)
39 internals
.settings
.setEditingBehavior(behavior
);
41 getSelection().modify("extend", "backward", "character");
42 getSelection().modify("extend", "backward", "character");
44 getSelection().modify("extend", "backward", "character");
45 getSelection().modify("extend", "backward", "character");
47 var selectedText
= getSelection().toString();
48 if (selectedText
== expectedText
)
51 logResult("FAILURE: The selected text is \"" + selectedText
+ "\" and should be \"" + expectedText
+ "\".");
55 <body onload=
"runTests()">
56 <p>This tests modifying a selection created with a double click with shift arrow key.
</p>
57 <p style=
"color:green">
58 This test does not run interactively.
59 It uses the event sender to do mouse clicks.
60 To run it manually, double click on the blue
"g", then press shift-left-arrow twice.
61 Then repeat those steps again.
62 The selection should include the words
"a paragraph" on mac and
"paragra" on win/linux..
64 <p>This is a para
<span style=
"color:blue" id=
"start">g
</span>raph.
</p>