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