mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1169096 - Test attribute filtering r=past
This commit is contained in:
parent
288bb717cb
commit
ed474802d1
@ -173,6 +173,7 @@ skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
|
||||
skip-if = buildapp == 'mulet' || e10s # Bug 1042253 - webconsole e10s tests
|
||||
[browser_console_variables_view.js]
|
||||
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
|
||||
[browser_console_variables_view_filter.js]
|
||||
[browser_console_variables_view_dom_nodes.js]
|
||||
[browser_console_variables_view_dont_sort_non_sortable_classes_properties.js]
|
||||
skip-if = buildapp == 'mulet'
|
||||
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Check that variables view filter feature works fine in the console.
|
||||
|
||||
function props(view, prefix = "") {
|
||||
// First match only the visible one, not hidden by a search
|
||||
let visible = [...view].filter(([id, prop]) => prop._isMatch);
|
||||
// Then flatten the list into a list of strings
|
||||
// being the jsonpath of each attribute being visible in the view
|
||||
return visible.reduce((list, [id, prop]) => {
|
||||
list.push(prefix + id);
|
||||
return list.concat(props(prop, prefix + id + "."));
|
||||
}, []);
|
||||
}
|
||||
|
||||
function assertAttrs(view, expected, message) {
|
||||
is(props(view).join(","), expected, message);
|
||||
}
|
||||
|
||||
let test = asyncTest(function* () {
|
||||
yield loadTab("data:text/html;charset=utf-8,webconsole-filter");
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
let jsterm = hud.jsterm;
|
||||
|
||||
let fetched = jsterm.once("variablesview-fetched");
|
||||
|
||||
yield jsterm.execute("inspect({ foo: { bar : \"baz\" } })");
|
||||
|
||||
let view = yield fetched;
|
||||
let variablesView = view._variablesView;
|
||||
let searchbox = variablesView._searchboxNode;
|
||||
|
||||
assertAttrs(view, "foo,__proto__", "To start with, we just see the top level foo attr");
|
||||
|
||||
fetched = jsterm.once("variablesview-fetched");
|
||||
searchbox.value = "bar";
|
||||
searchbox.doCommand();
|
||||
view = yield fetched;
|
||||
|
||||
assertAttrs(view, "", "If we don't manually expand nested attr, we don't see them in search");
|
||||
|
||||
fetched = jsterm.once("variablesview-fetched");
|
||||
searchbox.value = "";
|
||||
searchbox.doCommand();
|
||||
view = yield fetched;
|
||||
|
||||
assertAttrs(view, "foo", "If we reset the search, we get back to original state");
|
||||
|
||||
yield [...view][0][1].expand();
|
||||
|
||||
fetched = jsterm.once("variablesview-fetched");
|
||||
searchbox.value = "bar";
|
||||
searchbox.doCommand();
|
||||
view = yield fetched;
|
||||
|
||||
assertAttrs(view, "foo,foo.bar", "Now if we expand, we see the nested attr");
|
||||
|
||||
fetched = jsterm.once("variablesview-fetched");
|
||||
searchbox.value = "baz";
|
||||
searchbox.doCommand();
|
||||
view = yield fetched;
|
||||
|
||||
assertAttrs(view, "foo,foo.bar", "We can also search for attr values");
|
||||
|
||||
fetched = jsterm.once("variablesview-fetched");
|
||||
searchbox.value = "";
|
||||
searchbox.doCommand();
|
||||
view = yield fetched;
|
||||
|
||||
assertAttrs(view, "foo", "If we reset again, we get back to original state again");
|
||||
});
|
Loading…
Reference in New Issue
Block a user