|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 let cw; |
|
6 let win; |
|
7 |
|
8 let testFocusTitle = function () { |
|
9 let title = 'title'; |
|
10 let groupItem = cw.GroupItems.groupItems[0]; |
|
11 groupItem.setTitle(title); |
|
12 |
|
13 let target = groupItem.$titleShield[0]; |
|
14 EventUtils.synthesizeMouseAtCenter(target, {}, cw); |
|
15 |
|
16 let input = groupItem.$title[0]; |
|
17 is(input.selectionStart, 0, 'the whole text is selected'); |
|
18 is(input.selectionEnd, title.length, 'the whole text is selected'); |
|
19 |
|
20 EventUtils.synthesizeMouseAtCenter(input, {}, cw); |
|
21 is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected'); |
|
22 is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected'); |
|
23 |
|
24 win.close(); |
|
25 finish(); |
|
26 } |
|
27 |
|
28 waitForExplicitFinish(); |
|
29 |
|
30 newWindowWithTabView(function (tvwin) { |
|
31 win = tvwin; |
|
32 |
|
33 registerCleanupFunction(function () { |
|
34 if (!win.closed) |
|
35 win.close(); |
|
36 }); |
|
37 |
|
38 cw = win.TabView.getContentWindow(); |
|
39 SimpleTest.waitForFocus(testFocusTitle, cw); |
|
40 }); |
|
41 } |