diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/inspector/test/browser_inspector_menu-06-other.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/inspector/test/browser_inspector_menu-06-other.js')
-rw-r--r-- | devtools/client/inspector/test/browser_inspector_menu-06-other.js | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_menu-06-other.js b/devtools/client/inspector/test/browser_inspector_menu-06-other.js new file mode 100644 index 000000000..9f4310121 --- /dev/null +++ b/devtools/client/inspector/test/browser_inspector_menu-06-other.js @@ -0,0 +1,95 @@ +/* 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"; + +// Tests for menuitem functionality that doesn't fit into any specific category +const TEST_URL = URL_ROOT + "doc_inspector_menu.html"; +add_task(function* () { + let { inspector, toolbox, testActor } = yield openInspectorForURL(TEST_URL); + yield testShowDOMProperties(); + yield testDuplicateNode(); + yield testDeleteNode(); + yield testDeleteRootNode(); + yield testScrollIntoView(); + function* testShowDOMProperties() { + info("Testing 'Show DOM Properties' menu item."); + let allMenuItems = openContextMenuAndGetAllItems(inspector); + let showDOMPropertiesNode = + allMenuItems.find(item => item.id === "node-menu-showdomproperties"); + ok(showDOMPropertiesNode, "the popup menu has a show dom properties item"); + + let consoleOpened = toolbox.once("webconsole-ready"); + + info("Triggering 'Show DOM Properties' and waiting for inspector open"); + showDOMPropertiesNode.click(); + yield consoleOpened; + + let webconsoleUI = toolbox.getPanel("webconsole").hud.ui; + let messagesAdded = webconsoleUI.once("new-messages"); + yield messagesAdded; + info("Checking if 'inspect($0)' was evaluated"); + ok(webconsoleUI.jsterm.history[0] === "inspect($0)"); + yield toolbox.toggleSplitConsole(); + } + function* testDuplicateNode() { + info("Testing 'Duplicate Node' menu item for normal elements."); + + yield selectNode(".duplicate", inspector); + is((yield testActor.getNumberOfElementMatches(".duplicate")), 1, + "There should initially be 1 .duplicate node"); + + let allMenuItems = openContextMenuAndGetAllItems(inspector); + let menuItem = + allMenuItems.find(item => item.id === "node-menu-duplicatenode"); + ok(menuItem, "'Duplicate node' menu item should exist"); + + info("Triggering 'Duplicate Node' and waiting for inspector to update"); + let updated = inspector.once("markupmutation"); + menuItem.click(); + yield updated; + + is((yield testActor.getNumberOfElementMatches(".duplicate")), 2, + "The duplicated node should be in the markup."); + + let container = yield getContainerForSelector(".duplicate + .duplicate", + inspector); + ok(container, "A MarkupContainer should be created for the new node"); + } + + function* testDeleteNode() { + info("Testing 'Delete Node' menu item for normal elements."); + yield selectNode("#delete", inspector); + let allMenuItems = openContextMenuAndGetAllItems(inspector); + let deleteNode = allMenuItems.find(item => item.id === "node-menu-delete"); + ok(deleteNode, "the popup menu has a delete menu item"); + let updated = inspector.once("inspector-updated"); + + info("Triggering 'Delete Node' and waiting for inspector to update"); + deleteNode.click(); + yield updated; + + ok(!(yield testActor.hasNode("#delete")), "Node deleted"); + } + + function* testDeleteRootNode() { + info("Testing 'Delete Node' menu item does not delete root node."); + yield selectNode("html", inspector); + + let allMenuItems = openContextMenuAndGetAllItems(inspector); + let deleteNode = allMenuItems.find(item => item.id === "node-menu-delete"); + deleteNode.click(); + + let deferred = defer(); + executeSoon(deferred.resolve); + yield deferred.promise; + + ok((yield testActor.eval("!!content.document.documentElement")), + "Document element still alive."); + } + + function* testScrollIntoView() { + // Follow up bug to add this test - https://bugzilla.mozilla.org/show_bug.cgi?id=1154107 + todo(false, "Verify that node is scrolled into the viewport."); + } +}); |