browser/base/content/test/general/browser_bug597218.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_bug597218.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     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 +  waitForExplicitFinish();
    1.10 +
    1.11 +  // establish initial state
    1.12 +  is(gBrowser.tabs.length, 1, "we start with one tab");
    1.13 +  
    1.14 +  // create a tab
    1.15 +  let tab = gBrowser.loadOneTab("about:blank");
    1.16 +  ok(!tab.hidden, "tab starts out not hidden");
    1.17 +  is(gBrowser.tabs.length, 2, "we now have two tabs");
    1.18 +
    1.19 +  // make sure .hidden is read-only
    1.20 +  tab.hidden = true; 
    1.21 +  ok(!tab.hidden, "can't set .hidden directly");
    1.22 +
    1.23 +  // hide the tab
    1.24 +  gBrowser.hideTab(tab);
    1.25 +  ok(tab.hidden, "tab is hidden");
    1.26 +  
    1.27 +  // now pin it and make sure it gets unhidden
    1.28 +  gBrowser.pinTab(tab);
    1.29 +  ok(tab.pinned, "tab was pinned");
    1.30 +  ok(!tab.hidden, "tab was unhidden");
    1.31 +  
    1.32 +  // try hiding it now that it's pinned; shouldn't be able to
    1.33 +  gBrowser.hideTab(tab);
    1.34 +  ok(!tab.hidden, "tab did not hide");
    1.35 +    
    1.36 +  // clean up
    1.37 +  gBrowser.removeTab(tab);
    1.38 +  is(gBrowser.tabs.length, 1, "we finish with one tab");
    1.39 +
    1.40 +  finish();
    1.41 +}

mercurial