browser/devtools/debugger/test/browser_dbg_searchbox-parse.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b76b5d001aa2
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests that text entered in the debugger's searchbox is properly parsed.
6 */
7
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;
12
13 setText(searchbox, "");
14 is(filterView.searchData.toSource(), '["", [""]]',
15 "The searchbox data wasn't parsed correctly (1).");
16
17 setText(searchbox, "#token");
18 is(filterView.searchData.toSource(), '["#", ["", "token"]]',
19 "The searchbox data wasn't parsed correctly (2).");
20
21 setText(searchbox, ":42");
22 is(filterView.searchData.toSource(), '[":", ["", 42]]',
23 "The searchbox data wasn't parsed correctly (3).");
24
25 setText(searchbox, "#token:42");
26 is(filterView.searchData.toSource(), '["#", ["", "token:42"]]',
27 "The searchbox data wasn't parsed correctly (4).");
28
29 setText(searchbox, ":42#token");
30 is(filterView.searchData.toSource(), '["#", [":42", "token"]]',
31 "The searchbox data wasn't parsed correctly (5).");
32
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).");
36
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).");
40
41
42 setText(searchbox, "file");
43 is(filterView.searchData.toSource(), '["", ["file"]]',
44 "The searchbox data wasn't parsed correctly (8).");
45
46 setText(searchbox, "file#token");
47 is(filterView.searchData.toSource(), '["#", ["file", "token"]]',
48 "The searchbox data wasn't parsed correctly (9).");
49
50 setText(searchbox, "file:42");
51 is(filterView.searchData.toSource(), '[":", ["file", 42]]',
52 "The searchbox data wasn't parsed correctly (10).");
53
54 setText(searchbox, "file#token:42");
55 is(filterView.searchData.toSource(), '["#", ["file", "token:42"]]',
56 "The searchbox data wasn't parsed correctly (11).");
57
58 setText(searchbox, "file:42#token");
59 is(filterView.searchData.toSource(), '["#", ["file:42", "token"]]',
60 "The searchbox data wasn't parsed correctly (12).");
61
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).");
65
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).");
69
70
71 setText(searchbox, "!token");
72 is(filterView.searchData.toSource(), '["!", ["token"]]',
73 "The searchbox data wasn't parsed correctly (15).");
74
75 setText(searchbox, "!token#global");
76 is(filterView.searchData.toSource(), '["!", ["token#global"]]',
77 "The searchbox data wasn't parsed correctly (16).");
78
79 setText(searchbox, "!token#global:42");
80 is(filterView.searchData.toSource(), '["!", ["token#global:42"]]',
81 "The searchbox data wasn't parsed correctly (17).");
82
83 setText(searchbox, "!token:42#global");
84 is(filterView.searchData.toSource(), '["!", ["token:42#global"]]',
85 "The searchbox data wasn't parsed correctly (18).");
86
87
88 setText(searchbox, "@token");
89 is(filterView.searchData.toSource(), '["@", ["token"]]',
90 "The searchbox data wasn't parsed correctly (19).");
91
92 setText(searchbox, "@token#global");
93 is(filterView.searchData.toSource(), '["@", ["token#global"]]',
94 "The searchbox data wasn't parsed correctly (20).");
95
96 setText(searchbox, "@token#global:42");
97 is(filterView.searchData.toSource(), '["@", ["token#global:42"]]',
98 "The searchbox data wasn't parsed correctly (21).");
99
100 setText(searchbox, "@token:42#global");
101 is(filterView.searchData.toSource(), '["@", ["token:42#global"]]',
102 "The searchbox data wasn't parsed correctly (22).");
103
104
105 setText(searchbox, "*token");
106 is(filterView.searchData.toSource(), '["*", ["token"]]',
107 "The searchbox data wasn't parsed correctly (23).");
108
109 setText(searchbox, "*token#global");
110 is(filterView.searchData.toSource(), '["*", ["token#global"]]',
111 "The searchbox data wasn't parsed correctly (24).");
112
113 setText(searchbox, "*token#global:42");
114 is(filterView.searchData.toSource(), '["*", ["token#global:42"]]',
115 "The searchbox data wasn't parsed correctly (25).");
116
117 setText(searchbox, "*token:42#global");
118 is(filterView.searchData.toSource(), '["*", ["token:42#global"]]',
119 "The searchbox data wasn't parsed correctly (26).");
120
121
122 closeDebuggerAndFinish(aPanel);
123 });
124 }

mercurial