|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 waitForExplicitFinish(); |
|
6 |
|
7 let AllTabs; |
|
8 let newTab = gBrowser.addTab(); |
|
9 |
|
10 // TabPinned |
|
11 let pinned = function (event) { |
|
12 let tab = event.target; |
|
13 |
|
14 is(tab, newTab, "The tabs are the same after the tab is pinned"); |
|
15 ok(tab.pinned, "The tab gets pinned"); |
|
16 |
|
17 gBrowser.unpinTab(tab); |
|
18 }; |
|
19 |
|
20 // TabUnpinned |
|
21 let unpinned = function (event) { |
|
22 let tab = event.target; |
|
23 |
|
24 AllTabs.unregister("pinned", pinned); |
|
25 AllTabs.unregister("unpinned", unpinned); |
|
26 |
|
27 is(tab, newTab, "The tabs are the same after the tab is unpinned"); |
|
28 ok(!tab.pinned, "The tab gets unpinned"); |
|
29 |
|
30 // clean up and finish |
|
31 gBrowser.removeTab(tab); |
|
32 hideTabView(finish); |
|
33 }; |
|
34 |
|
35 showTabView(function () { |
|
36 AllTabs = TabView.getContentWindow().AllTabs; |
|
37 |
|
38 AllTabs.register("pinned", pinned); |
|
39 AllTabs.register("unpinned", unpinned); |
|
40 |
|
41 ok(!newTab.pinned, "The tab is not pinned"); |
|
42 gBrowser.pinTab(newTab); |
|
43 }); |
|
44 } |
|
45 |