diff options
Diffstat (limited to 'devtools/client/netmonitor/test/browser_net_filter-value-preserved.js')
-rw-r--r-- | devtools/client/netmonitor/test/browser_net_filter-value-preserved.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/test/browser_net_filter-value-preserved.js b/devtools/client/netmonitor/test/browser_net_filter-value-preserved.js new file mode 100644 index 0000000000..59eccc25f7 --- /dev/null +++ b/devtools/client/netmonitor/test/browser_net_filter-value-preserved.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Test that filter input keeps its value when host or panel changes + */ + +add_task(async function () { + const { monitor } = await initNetMonitor(FILTERING_URL, { requestCount: 1 }); + const { document, store, windowRequire } = monitor.panelWin; + const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); + + store.dispatch(Actions.batchEnable(false)); + + info("Starting test... "); + + const toolbars = document.querySelector("#netmonitor-toolbar-container"); + let input = toolbars.querySelector(".devtools-filterinput"); + input.value = "hello"; + + await monitor.toolbox.switchHost("right"); + await waitForTick(); + + is( + toolbars.querySelectorAll(".devtools-toolbar").length, + 2, + "Should be in 2 toolbar mode" + ); + + input = toolbars.querySelector(".devtools-filterinput"); + is( + input.value, + "hello", + "Value should be preserved after switching to right host" + ); + + await monitor.toolbox.switchHost("bottom"); + + input = toolbars.querySelector(".devtools-filterinput"); + is( + input.value, + "hello", + "Value should be preserved after switching to bottom host" + ); + + await monitor.toolbox.selectTool("inspector"); + await monitor.toolbox.selectTool("netmonitor"); + + input = toolbars.querySelector(".devtools-filterinput"); + is(input.value, "hello", "Value should be preserved after switching tools"); + + await teardown(monitor); +}); |