|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // ---------- |
|
5 function test() { |
|
6 waitForExplicitFinish(); |
|
7 |
|
8 let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/"; |
|
9 let newTab = gBrowser.addTab(urlBase + "search1.html"); |
|
10 |
|
11 registerCleanupFunction(function() { |
|
12 if (gBrowser.tabs[1]) |
|
13 gBrowser.removeTab(gBrowser.tabs[1]); |
|
14 TabView.hide(); |
|
15 }); |
|
16 |
|
17 afterAllTabsLoaded(function() { |
|
18 showTabView(function() { |
|
19 hideTabView(function() { |
|
20 newTab.linkedBrowser.loadURI(urlBase + "dummy_page.html"); |
|
21 |
|
22 newWindowWithTabView(function(win) { |
|
23 registerCleanupFunction(function() win.close()); |
|
24 |
|
25 let contentWindow = win.TabView.getContentWindow(); |
|
26 |
|
27 EventUtils.synthesizeKey("d", { }, contentWindow); |
|
28 EventUtils.synthesizeKey("u", { }, contentWindow); |
|
29 EventUtils.synthesizeKey("m", { }, contentWindow); |
|
30 |
|
31 let resultsElement = contentWindow.document.getElementById("results"); |
|
32 let childElements = resultsElement.childNodes; |
|
33 |
|
34 is(childElements.length, 1, "There is one result element"); |
|
35 is(childElements[0].childNodes[1].textContent, |
|
36 "This is a dummy test page", |
|
37 "The label matches the title of dummy page"); |
|
38 |
|
39 finish(); |
|
40 }); |
|
41 }); |
|
42 }); |
|
43 }); |
|
44 } |
|
45 |