michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: let cw; michael@0: let win; michael@0: michael@0: let testFocusTitle = function () { michael@0: let title = 'title'; michael@0: let groupItem = cw.GroupItems.groupItems[0]; michael@0: groupItem.setTitle(title); michael@0: michael@0: let target = groupItem.$titleShield[0]; michael@0: EventUtils.synthesizeMouseAtCenter(target, {}, cw); michael@0: michael@0: let input = groupItem.$title[0]; michael@0: is(input.selectionStart, 0, 'the whole text is selected'); michael@0: is(input.selectionEnd, title.length, 'the whole text is selected'); michael@0: michael@0: EventUtils.synthesizeMouseAtCenter(input, {}, cw); michael@0: is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected'); michael@0: is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected'); michael@0: michael@0: win.close(); michael@0: finish(); michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function (tvwin) { michael@0: win = tvwin; michael@0: michael@0: registerCleanupFunction(function () { michael@0: if (!win.closed) michael@0: win.close(); michael@0: }); michael@0: michael@0: cw = win.TabView.getContentWindow(); michael@0: SimpleTest.waitForFocus(testFocusTitle, cw); michael@0: }); michael@0: }