summaryrefslogtreecommitdiff
path: root/browser/base/content/test/browser_selectTabAtIndex.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/browser_selectTabAtIndex.js')
-rw-r--r--browser/base/content/test/browser_selectTabAtIndex.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/browser/base/content/test/browser_selectTabAtIndex.js b/browser/base/content/test/browser_selectTabAtIndex.js
new file mode 100644
index 000000000..e9a32184e
--- /dev/null
+++ b/browser/base/content/test/browser_selectTabAtIndex.js
@@ -0,0 +1,19 @@
+function test() {
+ for (let i = 0; i < 9; i++)
+ gBrowser.addTab();
+
+ var isLinux = navigator.platform.indexOf("Linux") == 0;
+ for (let i = 9; i >= 1; i--) {
+ EventUtils.synthesizeKey(i.toString(), { altKey: isLinux, accelKey: !isLinux });
+
+ is(gBrowser.tabContainer.selectedIndex, (i == 9 ? gBrowser.tabs.length : i) - 1,
+ (isLinux ? "Alt" : "Accel") + "+" + i + " selects expected tab");
+ }
+
+ gBrowser.selectTabAtIndex(-3);
+ is(gBrowser.tabContainer.selectedIndex, gBrowser.tabs.length - 3,
+ "gBrowser.selectTabAtIndex(-3) selects expected tab");
+
+ for (let i = 0; i < 9; i++)
+ gBrowser.removeCurrentTab();
+}