|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 let newWin; |
|
5 |
|
6 // ---------- |
|
7 function test() { |
|
8 waitForExplicitFinish(); |
|
9 |
|
10 let panelSelected = false; |
|
11 registerCleanupFunction(function () ok(panelSelected, "panel is selected")); |
|
12 |
|
13 let onLoad = function (win) { |
|
14 registerCleanupFunction(function () win.close()); |
|
15 |
|
16 newWin = win; |
|
17 |
|
18 let onSelect = function(event) { |
|
19 if (deck != event.target) |
|
20 return; |
|
21 |
|
22 let iframe = win.document.getElementById("tab-view"); |
|
23 if (deck.selectedPanel != iframe) |
|
24 return; |
|
25 |
|
26 deck.removeEventListener("select", onSelect, true); |
|
27 panelSelected = true; |
|
28 }; |
|
29 |
|
30 let deck = win.document.getElementById("tab-view-deck"); |
|
31 deck.addEventListener("select", onSelect, true); |
|
32 }; |
|
33 |
|
34 let onShow = function (win) { |
|
35 executeSoon(function() { |
|
36 testMethodToHideAndShowTabView(function() { |
|
37 newWin.document.getElementById("menu_tabview").doCommand(); |
|
38 }, function() { |
|
39 testMethodToHideAndShowTabView(function() { |
|
40 EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, newWin); |
|
41 }, finish); |
|
42 }); |
|
43 }); |
|
44 }; |
|
45 |
|
46 newWindowWithTabView(onShow, onLoad); |
|
47 } |
|
48 |
|
49 function testMethodToHideAndShowTabView(executeFunc, callback) { |
|
50 whenTabViewIsHidden(function() { |
|
51 ok(!newWin.TabView.isVisible(), "Tab View is not visible after executing the function"); |
|
52 whenTabViewIsShown(function() { |
|
53 ok(newWin.TabView.isVisible(), "Tab View is visible after executing the function again"); |
|
54 callback(); |
|
55 }, newWin); |
|
56 executeFunc(); |
|
57 }, newWin); |
|
58 executeFunc(); |
|
59 } |