diff options
Diffstat (limited to 'devtools/client/shared/test/unit/test_VariablesView_filtering-without-controller.js')
-rw-r--r-- | devtools/client/shared/test/unit/test_VariablesView_filtering-without-controller.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/devtools/client/shared/test/unit/test_VariablesView_filtering-without-controller.js b/devtools/client/shared/test/unit/test_VariablesView_filtering-without-controller.js new file mode 100644 index 000000000..5f4438234 --- /dev/null +++ b/devtools/client/shared/test/unit/test_VariablesView_filtering-without-controller.js @@ -0,0 +1,36 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that VariablesView._doSearch() works even without an attached +// VariablesViewController (bug 1196341). + +var Cu = Components.utils; +var Cc = Components.classes; +var Ci = Components.interfaces; +const DOMParser = Cc["@mozilla.org/xmlextras/domparser;1"] + .createInstance(Ci.nsIDOMParser); +const { VariablesView } = + Cu.import("resource://devtools/client/shared/widgets/VariablesView.jsm", {}); + +function run_test() { + let doc = DOMParser.parseFromString("<div>", "text/html"); + let container = doc.body.firstChild; + ok(container, "Got a container."); + + let vv = new VariablesView(container, { searchEnabled: true }); + let scope = vv.addScope("Test scope"); + let item1 = scope.addItem("a", { value: "1" }); + let item2 = scope.addItem("b", { value: "2" }); + + do_print("Performing a search without a controller."); + vv._doSearch("a"); + + equal(item1.target.hasAttribute("unmatched"), false, + "First item that matched the filter is visible."); + equal(item2.target.hasAttribute("unmatched"), true, + "The second item that did not match the filter is hidden."); +} |