Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests that text entered in the debugger's searchbox is properly parsed.
6 */
8 function test() {
9 initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => {
10 let filterView = aPanel.panelWin.DebuggerView.Filtering;
11 let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox;
13 setText(searchbox, "");
14 is(filterView.searchData.toSource(), '["", [""]]',
15 "The searchbox data wasn't parsed correctly (1).");
17 setText(searchbox, "#token");
18 is(filterView.searchData.toSource(), '["#", ["", "token"]]',
19 "The searchbox data wasn't parsed correctly (2).");
21 setText(searchbox, ":42");
22 is(filterView.searchData.toSource(), '[":", ["", 42]]',
23 "The searchbox data wasn't parsed correctly (3).");
25 setText(searchbox, "#token:42");
26 is(filterView.searchData.toSource(), '["#", ["", "token:42"]]',
27 "The searchbox data wasn't parsed correctly (4).");
29 setText(searchbox, ":42#token");
30 is(filterView.searchData.toSource(), '["#", [":42", "token"]]',
31 "The searchbox data wasn't parsed correctly (5).");
33 setText(searchbox, "#token:42#token:42");
34 is(filterView.searchData.toSource(), '["#", ["#token:42", "token:42"]]',
35 "The searchbox data wasn't parsed correctly (6).");
37 setText(searchbox, ":42#token:42#token");
38 is(filterView.searchData.toSource(), '["#", [":42#token:42", "token"]]',
39 "The searchbox data wasn't parsed correctly (7).");
42 setText(searchbox, "file");
43 is(filterView.searchData.toSource(), '["", ["file"]]',
44 "The searchbox data wasn't parsed correctly (8).");
46 setText(searchbox, "file#token");
47 is(filterView.searchData.toSource(), '["#", ["file", "token"]]',
48 "The searchbox data wasn't parsed correctly (9).");
50 setText(searchbox, "file:42");
51 is(filterView.searchData.toSource(), '[":", ["file", 42]]',
52 "The searchbox data wasn't parsed correctly (10).");
54 setText(searchbox, "file#token:42");
55 is(filterView.searchData.toSource(), '["#", ["file", "token:42"]]',
56 "The searchbox data wasn't parsed correctly (11).");
58 setText(searchbox, "file:42#token");
59 is(filterView.searchData.toSource(), '["#", ["file:42", "token"]]',
60 "The searchbox data wasn't parsed correctly (12).");
62 setText(searchbox, "file#token:42#token:42");
63 is(filterView.searchData.toSource(), '["#", ["file#token:42", "token:42"]]',
64 "The searchbox data wasn't parsed correctly (13).");
66 setText(searchbox, "file:42#token:42#token");
67 is(filterView.searchData.toSource(), '["#", ["file:42#token:42", "token"]]',
68 "The searchbox data wasn't parsed correctly (14).");
71 setText(searchbox, "!token");
72 is(filterView.searchData.toSource(), '["!", ["token"]]',
73 "The searchbox data wasn't parsed correctly (15).");
75 setText(searchbox, "!token#global");
76 is(filterView.searchData.toSource(), '["!", ["token#global"]]',
77 "The searchbox data wasn't parsed correctly (16).");
79 setText(searchbox, "!token#global:42");
80 is(filterView.searchData.toSource(), '["!", ["token#global:42"]]',
81 "The searchbox data wasn't parsed correctly (17).");
83 setText(searchbox, "!token:42#global");
84 is(filterView.searchData.toSource(), '["!", ["token:42#global"]]',
85 "The searchbox data wasn't parsed correctly (18).");
88 setText(searchbox, "@token");
89 is(filterView.searchData.toSource(), '["@", ["token"]]',
90 "The searchbox data wasn't parsed correctly (19).");
92 setText(searchbox, "@token#global");
93 is(filterView.searchData.toSource(), '["@", ["token#global"]]',
94 "The searchbox data wasn't parsed correctly (20).");
96 setText(searchbox, "@token#global:42");
97 is(filterView.searchData.toSource(), '["@", ["token#global:42"]]',
98 "The searchbox data wasn't parsed correctly (21).");
100 setText(searchbox, "@token:42#global");
101 is(filterView.searchData.toSource(), '["@", ["token:42#global"]]',
102 "The searchbox data wasn't parsed correctly (22).");
105 setText(searchbox, "*token");
106 is(filterView.searchData.toSource(), '["*", ["token"]]',
107 "The searchbox data wasn't parsed correctly (23).");
109 setText(searchbox, "*token#global");
110 is(filterView.searchData.toSource(), '["*", ["token#global"]]',
111 "The searchbox data wasn't parsed correctly (24).");
113 setText(searchbox, "*token#global:42");
114 is(filterView.searchData.toSource(), '["*", ["token#global:42"]]',
115 "The searchbox data wasn't parsed correctly (25).");
117 setText(searchbox, "*token:42#global");
118 is(filterView.searchData.toSource(), '["*", ["token:42#global"]]',
119 "The searchbox data wasn't parsed correctly (26).");
122 closeDebuggerAndFinish(aPanel);
123 });
124 }