browser/components/tabview/test/browser_tabview_bug599048.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:4304a005cd4e
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 let cw;
5
6 function test() {
7 waitForExplicitFinish();
8
9 showTabView(function() {
10 cw = TabView.getContentWindow();
11
12 whenSearchIsEnabled(function() {
13 ok(cw.Search.isEnabled(), "The search is disabled");
14
15 // open a new window and it would have the focus
16 newWindowWithTabView(function(win) {
17 registerCleanupFunction(function() {
18 win.close();
19 hideTabView();
20 });
21 testClickOnSearchShade(win);
22 });
23 });
24
25 EventUtils.synthesizeKey("VK_SLASH", {}, cw);
26 });
27 }
28
29 function testClickOnSearchShade(win) {
30 // click on the window with search enabled.
31 let searchshade = cw.document.getElementById("searchshade");
32 EventUtils.sendMouseEvent({ type: "click" }, searchshade, cw);
33
34 waitForFocus(function() {
35 ok(cw.Search.isEnabled(), "The search is still enabled after the search shade is clicked");
36 testFocusInactiveWindow(win, cw);
37 });
38 }
39
40 function testFocusInactiveWindow(win) {
41 win.focus();
42 // focus inactive window
43 window.focus();
44
45 // need to use exeuteSoon as the _blockClick would be set to false after a setTimeout(,0)
46 executeSoon(function() {
47 ok(cw.Search.isEnabled(), "The search is still enabled when inactive window has focus");
48
49 whenSearchIsDisabled(function() {
50 hideTabView(finish);
51 });
52
53 let searchshade = cw.document.getElementById("searchshade");
54 EventUtils.synthesizeMouseAtCenter(searchshade, {}, cw);
55 });
56 }
57

mercurial