browser/components/tabview/test/browser_tabview_bug618816.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug618816.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  let cw;
     1.9 +  let win;
    1.10 +
    1.11 +  let testFocusTitle = function () {
    1.12 +    let title = 'title';
    1.13 +    let groupItem = cw.GroupItems.groupItems[0];
    1.14 +    groupItem.setTitle(title);
    1.15 +
    1.16 +    let target = groupItem.$titleShield[0];
    1.17 +    EventUtils.synthesizeMouseAtCenter(target, {}, cw);
    1.18 +
    1.19 +    let input = groupItem.$title[0];
    1.20 +    is(input.selectionStart, 0, 'the whole text is selected');
    1.21 +    is(input.selectionEnd, title.length, 'the whole text is selected');
    1.22 +
    1.23 +    EventUtils.synthesizeMouseAtCenter(input, {}, cw);
    1.24 +    is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected');
    1.25 +    is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected');
    1.26 +
    1.27 +    win.close();
    1.28 +    finish();
    1.29 +  }
    1.30 +
    1.31 +  waitForExplicitFinish();
    1.32 +
    1.33 +  newWindowWithTabView(function (tvwin) {
    1.34 +    win = tvwin;
    1.35 +
    1.36 +    registerCleanupFunction(function () {
    1.37 +      if (!win.closed)
    1.38 +        win.close();
    1.39 +    });
    1.40 +
    1.41 +    cw = win.TabView.getContentWindow();
    1.42 +    SimpleTest.waitForFocus(testFocusTitle, cw);
    1.43 +  });
    1.44 +}

mercurial