diff -r 000000000000 -r 6474c204b198 browser/components/tabview/test/browser_tabview_bug618816.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/components/tabview/test/browser_tabview_bug618816.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + let cw; + let win; + + let testFocusTitle = function () { + let title = 'title'; + let groupItem = cw.GroupItems.groupItems[0]; + groupItem.setTitle(title); + + let target = groupItem.$titleShield[0]; + EventUtils.synthesizeMouseAtCenter(target, {}, cw); + + let input = groupItem.$title[0]; + is(input.selectionStart, 0, 'the whole text is selected'); + is(input.selectionEnd, title.length, 'the whole text is selected'); + + EventUtils.synthesizeMouseAtCenter(input, {}, cw); + is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected'); + is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected'); + + win.close(); + finish(); + } + + waitForExplicitFinish(); + + newWindowWithTabView(function (tvwin) { + win = tvwin; + + registerCleanupFunction(function () { + if (!win.closed) + win.close(); + }); + + cw = win.TabView.getContentWindow(); + SimpleTest.waitForFocus(testFocusTitle, cw); + }); +}