Test for bug 563588

This commit is contained in:
Dão Gottwald 2010-05-14 09:44:03 +02:00
parent 1523dc5451
commit f212588bd1
2 changed files with 31 additions and 0 deletions

View File

@ -119,6 +119,7 @@ _BROWSER_FILES = \
browser_bug537474.js \
browser_bug550565.js \
browser_bug555224.js \
browser_bug563588.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \
browser_discovery.js \

View File

@ -0,0 +1,30 @@
function press(key, expectedPos) {
var originalSelectedTab = gBrowser.selectedTab;
EventUtils.synthesizeKey("VK_" + key.toUpperCase(), { accelKey: true });
is(gBrowser.selectedTab, originalSelectedTab,
"accel+" + key + " doesn't change which tab is selected");
is(gBrowser.tabContainer.selectedIndex, expectedPos,
"accel+" + key + " moves the tab to the expected position");
is(document.activeElement, gBrowser.selectedTab,
"accel+" + key + " leaves the selected tab focused");
}
function test() {
gBrowser.addTab();
gBrowser.addTab();
is(gBrowser.tabs.length, 3, "got three tabs");
is(gBrowser.tabs[0], gBrowser.selectedTab, "first tab is selected");
gBrowser.selectedTab.focus();
is(document.activeElement, gBrowser.selectedTab, "selected tab is focused");
press("right", 1);
press("down", 2);
press("left", 1);
press("up", 0);
press("end", 2);
press("home", 0);
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
}