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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests that text entered in the debugger's searchbox is properly parsed.
michael@0 6 */
michael@0 7
michael@0 8 function test() {
michael@0 9 initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => {
michael@0 10 let filterView = aPanel.panelWin.DebuggerView.Filtering;
michael@0 11 let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox;
michael@0 12
michael@0 13 setText(searchbox, "");
michael@0 14 is(filterView.searchData.toSource(), '["", [""]]',
michael@0 15 "The searchbox data wasn't parsed correctly (1).");
michael@0 16
michael@0 17 setText(searchbox, "#token");
michael@0 18 is(filterView.searchData.toSource(), '["#", ["", "token"]]',
michael@0 19 "The searchbox data wasn't parsed correctly (2).");
michael@0 20
michael@0 21 setText(searchbox, ":42");
michael@0 22 is(filterView.searchData.toSource(), '[":", ["", 42]]',
michael@0 23 "The searchbox data wasn't parsed correctly (3).");
michael@0 24
michael@0 25 setText(searchbox, "#token:42");
michael@0 26 is(filterView.searchData.toSource(), '["#", ["", "token:42"]]',
michael@0 27 "The searchbox data wasn't parsed correctly (4).");
michael@0 28
michael@0 29 setText(searchbox, ":42#token");
michael@0 30 is(filterView.searchData.toSource(), '["#", [":42", "token"]]',
michael@0 31 "The searchbox data wasn't parsed correctly (5).");
michael@0 32
michael@0 33 setText(searchbox, "#token:42#token:42");
michael@0 34 is(filterView.searchData.toSource(), '["#", ["#token:42", "token:42"]]',
michael@0 35 "The searchbox data wasn't parsed correctly (6).");
michael@0 36
michael@0 37 setText(searchbox, ":42#token:42#token");
michael@0 38 is(filterView.searchData.toSource(), '["#", [":42#token:42", "token"]]',
michael@0 39 "The searchbox data wasn't parsed correctly (7).");
michael@0 40
michael@0 41
michael@0 42 setText(searchbox, "file");
michael@0 43 is(filterView.searchData.toSource(), '["", ["file"]]',
michael@0 44 "The searchbox data wasn't parsed correctly (8).");
michael@0 45
michael@0 46 setText(searchbox, "file#token");
michael@0 47 is(filterView.searchData.toSource(), '["#", ["file", "token"]]',
michael@0 48 "The searchbox data wasn't parsed correctly (9).");
michael@0 49
michael@0 50 setText(searchbox, "file:42");
michael@0 51 is(filterView.searchData.toSource(), '[":", ["file", 42]]',
michael@0 52 "The searchbox data wasn't parsed correctly (10).");
michael@0 53
michael@0 54 setText(searchbox, "file#token:42");
michael@0 55 is(filterView.searchData.toSource(), '["#", ["file", "token:42"]]',
michael@0 56 "The searchbox data wasn't parsed correctly (11).");
michael@0 57
michael@0 58 setText(searchbox, "file:42#token");
michael@0 59 is(filterView.searchData.toSource(), '["#", ["file:42", "token"]]',
michael@0 60 "The searchbox data wasn't parsed correctly (12).");
michael@0 61
michael@0 62 setText(searchbox, "file#token:42#token:42");
michael@0 63 is(filterView.searchData.toSource(), '["#", ["file#token:42", "token:42"]]',
michael@0 64 "The searchbox data wasn't parsed correctly (13).");
michael@0 65
michael@0 66 setText(searchbox, "file:42#token:42#token");
michael@0 67 is(filterView.searchData.toSource(), '["#", ["file:42#token:42", "token"]]',
michael@0 68 "The searchbox data wasn't parsed correctly (14).");
michael@0 69
michael@0 70
michael@0 71 setText(searchbox, "!token");
michael@0 72 is(filterView.searchData.toSource(), '["!", ["token"]]',
michael@0 73 "The searchbox data wasn't parsed correctly (15).");
michael@0 74
michael@0 75 setText(searchbox, "!token#global");
michael@0 76 is(filterView.searchData.toSource(), '["!", ["token#global"]]',
michael@0 77 "The searchbox data wasn't parsed correctly (16).");
michael@0 78
michael@0 79 setText(searchbox, "!token#global:42");
michael@0 80 is(filterView.searchData.toSource(), '["!", ["token#global:42"]]',
michael@0 81 "The searchbox data wasn't parsed correctly (17).");
michael@0 82
michael@0 83 setText(searchbox, "!token:42#global");
michael@0 84 is(filterView.searchData.toSource(), '["!", ["token:42#global"]]',
michael@0 85 "The searchbox data wasn't parsed correctly (18).");
michael@0 86
michael@0 87
michael@0 88 setText(searchbox, "@token");
michael@0 89 is(filterView.searchData.toSource(), '["@", ["token"]]',
michael@0 90 "The searchbox data wasn't parsed correctly (19).");
michael@0 91
michael@0 92 setText(searchbox, "@token#global");
michael@0 93 is(filterView.searchData.toSource(), '["@", ["token#global"]]',
michael@0 94 "The searchbox data wasn't parsed correctly (20).");
michael@0 95
michael@0 96 setText(searchbox, "@token#global:42");
michael@0 97 is(filterView.searchData.toSource(), '["@", ["token#global:42"]]',
michael@0 98 "The searchbox data wasn't parsed correctly (21).");
michael@0 99
michael@0 100 setText(searchbox, "@token:42#global");
michael@0 101 is(filterView.searchData.toSource(), '["@", ["token:42#global"]]',
michael@0 102 "The searchbox data wasn't parsed correctly (22).");
michael@0 103
michael@0 104
michael@0 105 setText(searchbox, "*token");
michael@0 106 is(filterView.searchData.toSource(), '["*", ["token"]]',
michael@0 107 "The searchbox data wasn't parsed correctly (23).");
michael@0 108
michael@0 109 setText(searchbox, "*token#global");
michael@0 110 is(filterView.searchData.toSource(), '["*", ["token#global"]]',
michael@0 111 "The searchbox data wasn't parsed correctly (24).");
michael@0 112
michael@0 113 setText(searchbox, "*token#global:42");
michael@0 114 is(filterView.searchData.toSource(), '["*", ["token#global:42"]]',
michael@0 115 "The searchbox data wasn't parsed correctly (25).");
michael@0 116
michael@0 117 setText(searchbox, "*token:42#global");
michael@0 118 is(filterView.searchData.toSource(), '["*", ["token:42#global"]]',
michael@0 119 "The searchbox data wasn't parsed correctly (26).");
michael@0 120
michael@0 121
michael@0 122 closeDebuggerAndFinish(aPanel);
michael@0 123 });
michael@0 124 }

mercurial