# HG changeset patch # User Julian Descottes # Date 1516918031 -3600 # Node ID d2b86105593665fb53ea47b4a1934404474d94b2 # Parent e273eb983a7c646e7f3855bb1900a333afa45041 Bug 1269527 - stop showing incorrect closing tagline for #document;r=bgrins MozReview-Commit-ID: 9htiEEWlCTG diff --git a/devtools/client/inspector/markup/test/browser.ini b/devtools/client/inspector/markup/test/browser.ini --- a/devtools/client/inspector/markup/test/browser.ini +++ b/devtools/client/inspector/markup/test/browser.ini @@ -181,12 +181,13 @@ skip-if = e10s # Bug 1036409 - The last [browser_markup_tag_edit_avoid_refocus.js] [browser_markup_tag_edit_long-classname.js] [browser_markup_textcontent_display.js] [browser_markup_textcontent_edit_01.js] [browser_markup_textcontent_edit_02.js] [browser_markup_toggle_01.js] [browser_markup_toggle_02.js] [browser_markup_toggle_03.js] +[browser_markup_toggle_closing_tag_line.js] [browser_markup_update-on-navigtion.js] [browser_markup_void_elements_html.js] [browser_markup_void_elements_xhtml.js] [browser_markup_whitespace.js] diff --git a/devtools/client/inspector/markup/test/browser_markup_toggle_closing_tag_line.js b/devtools/client/inspector/markup/test/browser_markup_toggle_closing_tag_line.js new file mode 100644 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_toggle_closing_tag_line.js @@ -0,0 +1,45 @@ +/* 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 a closing tag line is displayed when expanding an element container. +// Also check that no closing tag line is displayed for readonly containers (document, +// roots...). + +const TEST_URL = `data:text/html;charset=utf8, +
test
+`; + +add_task(async function () { + let {inspector} = await openInspectorForURL(TEST_URL); + + info("Getting the container for .outer-div parent element"); + let container = await getContainerForSelector(".outer-div", inspector); + await expandContainer(inspector, container); + + let closeTagLine = container.closeTagLine; + ok(closeTagLine && closeTagLine.textContent.includes("div"), + "DIV has a close tag-line with the correct content"); + + info("Expand the iframe element"); + container = await getContainerForSelector("iframe", inspector); + await expandContainer(inspector, container); + ok(container.expanded, "iframe is expanded"); + closeTagLine = container.closeTagLine; + ok(closeTagLine && closeTagLine.textContent.includes("iframe"), + "IFRAME has a close tag-line with the correct content"); + + info("Retrieve the nodefront for the #document root inside the iframe"); + let iframe = await getNodeFront("iframe", inspector); + let {nodes} = await inspector.walker.children(iframe); + let documentFront = nodes[0]; + ok(documentFront.displayName === "#document", "First child of IFRAME is #document"); + + info("Expand the iframe's #document node element"); + container = getContainerForNodeFront(documentFront, inspector); + await expandContainer(inspector, container); + ok(container.expanded, "#document is expanded"); + ok(!container.closeTagLine, "readonly (#document) node has no close tag-line"); +}); diff --git a/devtools/client/inspector/markup/test/head.js b/devtools/client/inspector/markup/test/head.js --- a/devtools/client/inspector/markup/test/head.js +++ b/devtools/client/inspector/markup/test/head.js @@ -629,8 +629,21 @@ function* checkDeleteAndSelection(inspec let node = yield getNodeFront(selector, inspector); ok(!node, "The node can't be found in the page anymore"); info("Undo the deletion to restore the original markup"); yield undoChange(inspector); node = yield getNodeFront(selector, inspector); ok(node, "The node is back"); } + +/** + * Expand the provided markup container by clicking on the expand arrow and waiting for + * inspector and children to update. + */ +async function expandContainer(inspector, container) { + let onChildren = waitForChildrenUpdated(inspector); + let onUpdated = inspector.once("inspector-updated"); + EventUtils.synthesizeMouseAtCenter(container.expander, {}, + inspector.markup.doc.defaultView); + await onChildren; + await onUpdated; +} diff --git a/devtools/client/inspector/markup/views/markup-container.js b/devtools/client/inspector/markup/views/markup-container.js --- a/devtools/client/inspector/markup/views/markup-container.js +++ b/devtools/client/inspector/markup/views/markup-container.js @@ -6,16 +6,22 @@ const {Task} = require("devtools/shared/task"); const {KeyCodes} = require("devtools/client/shared/keycodes"); const {flashElementOn, flashElementOff} = require("devtools/client/inspector/markup/utils"); const DRAG_DROP_MIN_INITIAL_DISTANCE = 10; +const TYPES = { + TEXT_CONTAINER: "textcontainer", + ELEMENT_CONTAINER: "elementcontainer", + READ_ONLY_CONTAINER: "readonlycontainer", +}; + /** * The main structure for storing a document node in the markup * tree. Manages creation of the editor for the node and * a