browser/components/tabview/test/browser_tabview_bug600812.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 function test() {
michael@0 5 let cw;
michael@0 6
michael@0 7 let createGroupItem = function () {
michael@0 8 let bounds = new cw.Rect(20, 20, 150, 150);
michael@0 9 let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true});
michael@0 10
michael@0 11 cw.UI.setActive(groupItem);
michael@0 12 gBrowser.loadOneTab('about:blank', {inBackground: true});
michael@0 13
michael@0 14 return groupItem;
michael@0 15 }
michael@0 16
michael@0 17 let testVeryQuickDragAndDrop = function () {
michael@0 18 let sourceGroup = createGroupItem();
michael@0 19 let targetGroup = cw.GroupItems.groupItems[0];
michael@0 20
michael@0 21 sourceGroup.pushAway(true);
michael@0 22 targetGroup.pushAway(true);
michael@0 23
michael@0 24 let sourceTab = sourceGroup.getChild(0).container;
michael@0 25 EventUtils.synthesizeMouseAtCenter(sourceTab, {type: 'mousedown'}, cw);
michael@0 26
michael@0 27 let targetTab = targetGroup.getChild(0).container;
michael@0 28 EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mousemove'}, cw);
michael@0 29 EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mouseup'}, cw);
michael@0 30
michael@0 31 is(targetGroup.getChildren().length, 2, 'target group has two tabs');
michael@0 32 is(cw.GroupItems.groupItems.length, 1, 'sourceGroup was closed');
michael@0 33 isnot(cw.GroupItems.groupItems[0], sourceGroup, 'sourceGroup was closed');
michael@0 34
michael@0 35 targetGroup.getChild(0).close();
michael@0 36 hideTabView(finish);
michael@0 37 }
michael@0 38
michael@0 39 waitForExplicitFinish();
michael@0 40
michael@0 41 showTabView(function () {
michael@0 42 cw = TabView.getContentWindow();
michael@0 43 afterAllTabsLoaded(testVeryQuickDragAndDrop);
michael@0 44 });
michael@0 45 }

mercurial