1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/markupview/test/browser_markupview_textcontent_edit_01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +// Test editing a node's text content 1.11 + 1.12 +const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html"; 1.13 + 1.14 +let test = asyncTest(function*() { 1.15 + let {inspector} = yield addTab(TEST_URL).then(openInspector); 1.16 + 1.17 + info("Expanding all nodes"); 1.18 + yield inspector.markup.expandAll(); 1.19 + 1.20 + let node = getNode(".node6").firstChild; 1.21 + is(node.nodeValue, "line6", "The test node's text content is correct"); 1.22 + 1.23 + info("Changing the text content"); 1.24 + 1.25 + info("Listening to the markupmutation event"); 1.26 + let onMutated = inspector.once("markupmutation"); 1.27 + let editor = getContainerForRawNode(node, inspector).editor; 1.28 + let field = editor.elt.querySelector("pre"); 1.29 + setEditableFieldValue(field, "New text", inspector); 1.30 + yield onMutated; 1.31 + 1.32 + is(node.nodeValue, "New text", "Test test node's text content has changed"); 1.33 + 1.34 + yield inspector.once("inspector-updated"); 1.35 +});