browser_bug563588.js (1092B)
1 function press(key, expectedPos) { 2 var originalSelectedTab = gBrowser.selectedTab; 3 EventUtils.synthesizeKey("VK_" + key.toUpperCase(), { 4 accelKey: true, 5 shiftKey: true, 6 }); 7 is( 8 gBrowser.selectedTab, 9 originalSelectedTab, 10 "shift+accel+" + key + " doesn't change which tab is selected" 11 ); 12 is( 13 gBrowser.tabContainer.selectedIndex, 14 expectedPos, 15 "shift+accel+" + key + " moves the tab to the expected position" 16 ); 17 is( 18 document.activeElement, 19 gBrowser.selectedTab, 20 "shift+accel+" + key + " leaves the selected tab focused" 21 ); 22 } 23 24 function test() { 25 BrowserTestUtils.addTab(gBrowser); 26 BrowserTestUtils.addTab(gBrowser); 27 is(gBrowser.tabs.length, 3, "got three tabs"); 28 is(gBrowser.tabs[0], gBrowser.selectedTab, "first tab is selected"); 29 30 gBrowser.selectedTab.focus(); 31 is(document.activeElement, gBrowser.selectedTab, "selected tab is focused"); 32 33 press("right", 1); 34 press("down", 2); 35 press("left", 1); 36 press("up", 0); 37 press("end", 2); 38 press("home", 0); 39 40 gBrowser.removeCurrentTab(); 41 gBrowser.removeCurrentTab(); 42 }