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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_searchbox-parse.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,124 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests that text entered in the debugger's searchbox is properly parsed.
     1.9 + */
    1.10 +
    1.11 +function test() {
    1.12 +  initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => {
    1.13 +    let filterView = aPanel.panelWin.DebuggerView.Filtering;
    1.14 +    let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox;
    1.15 +
    1.16 +    setText(searchbox, "");
    1.17 +    is(filterView.searchData.toSource(), '["", [""]]',
    1.18 +      "The searchbox data wasn't parsed correctly (1).");
    1.19 +
    1.20 +    setText(searchbox, "#token");
    1.21 +    is(filterView.searchData.toSource(), '["#", ["", "token"]]',
    1.22 +      "The searchbox data wasn't parsed correctly (2).");
    1.23 +
    1.24 +    setText(searchbox, ":42");
    1.25 +    is(filterView.searchData.toSource(), '[":", ["", 42]]',
    1.26 +      "The searchbox data wasn't parsed correctly (3).");
    1.27 +
    1.28 +    setText(searchbox, "#token:42");
    1.29 +    is(filterView.searchData.toSource(), '["#", ["", "token:42"]]',
    1.30 +      "The searchbox data wasn't parsed correctly (4).");
    1.31 +
    1.32 +    setText(searchbox, ":42#token");
    1.33 +    is(filterView.searchData.toSource(), '["#", [":42", "token"]]',
    1.34 +      "The searchbox data wasn't parsed correctly (5).");
    1.35 +
    1.36 +    setText(searchbox, "#token:42#token:42");
    1.37 +    is(filterView.searchData.toSource(), '["#", ["#token:42", "token:42"]]',
    1.38 +      "The searchbox data wasn't parsed correctly (6).");
    1.39 +
    1.40 +    setText(searchbox, ":42#token:42#token");
    1.41 +    is(filterView.searchData.toSource(), '["#", [":42#token:42", "token"]]',
    1.42 +      "The searchbox data wasn't parsed correctly (7).");
    1.43 +
    1.44 +
    1.45 +    setText(searchbox, "file");
    1.46 +    is(filterView.searchData.toSource(), '["", ["file"]]',
    1.47 +      "The searchbox data wasn't parsed correctly (8).");
    1.48 +
    1.49 +    setText(searchbox, "file#token");
    1.50 +    is(filterView.searchData.toSource(), '["#", ["file", "token"]]',
    1.51 +      "The searchbox data wasn't parsed correctly (9).");
    1.52 +
    1.53 +    setText(searchbox, "file:42");
    1.54 +    is(filterView.searchData.toSource(), '[":", ["file", 42]]',
    1.55 +      "The searchbox data wasn't parsed correctly (10).");
    1.56 +
    1.57 +    setText(searchbox, "file#token:42");
    1.58 +    is(filterView.searchData.toSource(), '["#", ["file", "token:42"]]',
    1.59 +      "The searchbox data wasn't parsed correctly (11).");
    1.60 +
    1.61 +    setText(searchbox, "file:42#token");
    1.62 +    is(filterView.searchData.toSource(), '["#", ["file:42", "token"]]',
    1.63 +      "The searchbox data wasn't parsed correctly (12).");
    1.64 +
    1.65 +    setText(searchbox, "file#token:42#token:42");
    1.66 +    is(filterView.searchData.toSource(), '["#", ["file#token:42", "token:42"]]',
    1.67 +      "The searchbox data wasn't parsed correctly (13).");
    1.68 +
    1.69 +    setText(searchbox, "file:42#token:42#token");
    1.70 +    is(filterView.searchData.toSource(), '["#", ["file:42#token:42", "token"]]',
    1.71 +      "The searchbox data wasn't parsed correctly (14).");
    1.72 +
    1.73 +
    1.74 +    setText(searchbox, "!token");
    1.75 +    is(filterView.searchData.toSource(), '["!", ["token"]]',
    1.76 +      "The searchbox data wasn't parsed correctly (15).");
    1.77 +
    1.78 +    setText(searchbox, "!token#global");
    1.79 +    is(filterView.searchData.toSource(), '["!", ["token#global"]]',
    1.80 +      "The searchbox data wasn't parsed correctly (16).");
    1.81 +
    1.82 +    setText(searchbox, "!token#global:42");
    1.83 +    is(filterView.searchData.toSource(), '["!", ["token#global:42"]]',
    1.84 +      "The searchbox data wasn't parsed correctly (17).");
    1.85 +
    1.86 +    setText(searchbox, "!token:42#global");
    1.87 +    is(filterView.searchData.toSource(), '["!", ["token:42#global"]]',
    1.88 +      "The searchbox data wasn't parsed correctly (18).");
    1.89 +
    1.90 +
    1.91 +    setText(searchbox, "@token");
    1.92 +    is(filterView.searchData.toSource(), '["@", ["token"]]',
    1.93 +      "The searchbox data wasn't parsed correctly (19).");
    1.94 +
    1.95 +    setText(searchbox, "@token#global");
    1.96 +    is(filterView.searchData.toSource(), '["@", ["token#global"]]',
    1.97 +      "The searchbox data wasn't parsed correctly (20).");
    1.98 +
    1.99 +    setText(searchbox, "@token#global:42");
   1.100 +    is(filterView.searchData.toSource(), '["@", ["token#global:42"]]',
   1.101 +      "The searchbox data wasn't parsed correctly (21).");
   1.102 +
   1.103 +    setText(searchbox, "@token:42#global");
   1.104 +    is(filterView.searchData.toSource(), '["@", ["token:42#global"]]',
   1.105 +      "The searchbox data wasn't parsed correctly (22).");
   1.106 +
   1.107 +
   1.108 +    setText(searchbox, "*token");
   1.109 +    is(filterView.searchData.toSource(), '["*", ["token"]]',
   1.110 +      "The searchbox data wasn't parsed correctly (23).");
   1.111 +
   1.112 +    setText(searchbox, "*token#global");
   1.113 +    is(filterView.searchData.toSource(), '["*", ["token#global"]]',
   1.114 +      "The searchbox data wasn't parsed correctly (24).");
   1.115 +
   1.116 +    setText(searchbox, "*token#global:42");
   1.117 +    is(filterView.searchData.toSource(), '["*", ["token#global:42"]]',
   1.118 +      "The searchbox data wasn't parsed correctly (25).");
   1.119 +
   1.120 +    setText(searchbox, "*token:42#global");
   1.121 +    is(filterView.searchData.toSource(), '["*", ["token:42#global"]]',
   1.122 +      "The searchbox data wasn't parsed correctly (26).");
   1.123 +
   1.124 +
   1.125 +    closeDebuggerAndFinish(aPanel);
   1.126 +  });
   1.127 +}

mercurial