browser/base/content/test/general/browser_bug563588.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 function press(key, expectedPos) {
michael@0 2 var originalSelectedTab = gBrowser.selectedTab;
michael@0 3 EventUtils.synthesizeKey("VK_" + key.toUpperCase(), { accelKey: true });
michael@0 4 is(gBrowser.selectedTab, originalSelectedTab,
michael@0 5 "accel+" + key + " doesn't change which tab is selected");
michael@0 6 is(gBrowser.tabContainer.selectedIndex, expectedPos,
michael@0 7 "accel+" + key + " moves the tab to the expected position");
michael@0 8 is(document.activeElement, gBrowser.selectedTab,
michael@0 9 "accel+" + key + " leaves the selected tab focused");
michael@0 10 }
michael@0 11
michael@0 12 function test() {
michael@0 13 gBrowser.addTab();
michael@0 14 gBrowser.addTab();
michael@0 15 is(gBrowser.tabs.length, 3, "got three tabs");
michael@0 16 is(gBrowser.tabs[0], gBrowser.selectedTab, "first tab is selected");
michael@0 17
michael@0 18 gBrowser.selectedTab.focus();
michael@0 19 is(document.activeElement, gBrowser.selectedTab, "selected tab is focused");
michael@0 20
michael@0 21 press("right", 1);
michael@0 22 press("down", 2);
michael@0 23 press("left", 1);
michael@0 24 press("up", 0);
michael@0 25 press("end", 2);
michael@0 26 press("home", 0);
michael@0 27
michael@0 28 gBrowser.removeCurrentTab();
michael@0 29 gBrowser.removeCurrentTab();
michael@0 30 }

mercurial