diff options
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/test/browser_inspector_highlighter-autohide-config_02.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-autohide-config_02.js b/devtools/client/inspector/test/browser_inspector_highlighter-autohide-config_02.js new file mode 100644 index 0000000000..bebc87f593 --- /dev/null +++ b/devtools/client/inspector/test/browser_inspector_highlighter-autohide-config_02.js @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +// Test that configuring two different highlighters to autohide +// will not overwrite each other's timers. +add_task(async function () { + info("Loading the test document and opening the inspector"); + const { inspector } = await openInspectorForURL( + "data:text/html;charset=utf-8,<p id='one'>TEST 1</p>" + ); + + const HALF_SECOND = 500; + const nodeFront = await getNodeFront("#one", inspector); + + const waitForShowEvents = waitForNEvents( + inspector.highlighters, + "highlighter-shown", + 2 + ); + const waitForHideEvents = waitForNEvents( + inspector.highlighters, + "highlighter-hidden", + 2 + ); + + info("Show Box Model Highlighter, then hide after half a second"); + inspector.highlighters.showHighlighterTypeForNode( + inspector.highlighters.TYPES.BOXMODEL, + nodeFront, + { duration: HALF_SECOND } + ); + + info("Show Selector Highlighter, then hide after half a second"); + inspector.highlighters.showHighlighterTypeForNode( + inspector.highlighters.TYPES.SELECTOR, + nodeFront, + { selector: "#one", duration: HALF_SECOND } + ); + + info("Waiting for 2 highlighter-shown and 2 highlighter-hidden events"); + await Promise.all([waitForShowEvents, waitForHideEvents]); +}); |