|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 function test() { |
|
6 waitForExplicitFinish(); |
|
7 |
|
8 // establish initial state |
|
9 is(gBrowser.tabs.length, 1, "we start with one tab"); |
|
10 |
|
11 // create a tab |
|
12 let tab = gBrowser.loadOneTab("about:blank"); |
|
13 ok(!tab.hidden, "tab starts out not hidden"); |
|
14 is(gBrowser.tabs.length, 2, "we now have two tabs"); |
|
15 |
|
16 // make sure .hidden is read-only |
|
17 tab.hidden = true; |
|
18 ok(!tab.hidden, "can't set .hidden directly"); |
|
19 |
|
20 // hide the tab |
|
21 gBrowser.hideTab(tab); |
|
22 ok(tab.hidden, "tab is hidden"); |
|
23 |
|
24 // now pin it and make sure it gets unhidden |
|
25 gBrowser.pinTab(tab); |
|
26 ok(tab.pinned, "tab was pinned"); |
|
27 ok(!tab.hidden, "tab was unhidden"); |
|
28 |
|
29 // try hiding it now that it's pinned; shouldn't be able to |
|
30 gBrowser.hideTab(tab); |
|
31 ok(!tab.hidden, "tab did not hide"); |
|
32 |
|
33 // clean up |
|
34 gBrowser.removeTab(tab); |
|
35 is(gBrowser.tabs.length, 1, "we finish with one tab"); |
|
36 |
|
37 finish(); |
|
38 } |