browser/base/content/test/general/browser_bug577121.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug577121.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +function test() {
     1.9 +  Services.prefs.setBoolPref("browser.tabs.animate", false);
    1.10 +  registerCleanupFunction(function() {
    1.11 +    Services.prefs.clearUserPref("browser.tabs.animate");
    1.12 +  });
    1.13 +
    1.14 +  // Open 2 other tabs, and pin the second one. Like that, the initial tab
    1.15 +  // should get closed.
    1.16 +  let testTab1 = gBrowser.addTab();
    1.17 +  let testTab2 = gBrowser.addTab();
    1.18 +  gBrowser.pinTab(testTab2);
    1.19 +
    1.20 +  // Now execute "Close other Tabs" on the first manually opened tab (tab1).
    1.21 +  // -> tab2 ist pinned, tab1 should remain open and the initial tab should
    1.22 +  // get closed.
    1.23 +  gBrowser.removeAllTabsBut(testTab1);
    1.24 +
    1.25 +  is(gBrowser.tabs.length, 2, "there are two remaining tabs open");
    1.26 +  is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open");
    1.27 +  is(gBrowser.tabs[1], testTab1, "tab1 stayed open");
    1.28 +  
    1.29 +  // Cleanup. Close only one tab because we need an opened tab at the end of
    1.30 +  // the test.
    1.31 +  gBrowser.removeTab(testTab2);
    1.32 +}

mercurial