1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug563588.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +function press(key, expectedPos) { 1.5 + var originalSelectedTab = gBrowser.selectedTab; 1.6 + EventUtils.synthesizeKey("VK_" + key.toUpperCase(), { accelKey: true }); 1.7 + is(gBrowser.selectedTab, originalSelectedTab, 1.8 + "accel+" + key + " doesn't change which tab is selected"); 1.9 + is(gBrowser.tabContainer.selectedIndex, expectedPos, 1.10 + "accel+" + key + " moves the tab to the expected position"); 1.11 + is(document.activeElement, gBrowser.selectedTab, 1.12 + "accel+" + key + " leaves the selected tab focused"); 1.13 +} 1.14 + 1.15 +function test() { 1.16 + gBrowser.addTab(); 1.17 + gBrowser.addTab(); 1.18 + is(gBrowser.tabs.length, 3, "got three tabs"); 1.19 + is(gBrowser.tabs[0], gBrowser.selectedTab, "first tab is selected"); 1.20 + 1.21 + gBrowser.selectedTab.focus(); 1.22 + is(document.activeElement, gBrowser.selectedTab, "selected tab is focused"); 1.23 + 1.24 + press("right", 1); 1.25 + press("down", 2); 1.26 + press("left", 1); 1.27 + press("up", 0); 1.28 + press("end", 2); 1.29 + press("home", 0); 1.30 + 1.31 + gBrowser.removeCurrentTab(); 1.32 + gBrowser.removeCurrentTab(); 1.33 +}