browser/devtools/markupview/test/browser_markupview_textcontent_edit_01.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 // Test editing a node's text content
michael@0 8
michael@0 9 const TEST_URL = TEST_URL_ROOT + "doc_markup_edit.html";
michael@0 10
michael@0 11 let test = asyncTest(function*() {
michael@0 12 let {inspector} = yield addTab(TEST_URL).then(openInspector);
michael@0 13
michael@0 14 info("Expanding all nodes");
michael@0 15 yield inspector.markup.expandAll();
michael@0 16
michael@0 17 let node = getNode(".node6").firstChild;
michael@0 18 is(node.nodeValue, "line6", "The test node's text content is correct");
michael@0 19
michael@0 20 info("Changing the text content");
michael@0 21
michael@0 22 info("Listening to the markupmutation event");
michael@0 23 let onMutated = inspector.once("markupmutation");
michael@0 24 let editor = getContainerForRawNode(node, inspector).editor;
michael@0 25 let field = editor.elt.querySelector("pre");
michael@0 26 setEditableFieldValue(field, "New text", inspector);
michael@0 27 yield onMutated;
michael@0 28
michael@0 29 is(node.nodeValue, "New text", "Test test node's text content has changed");
michael@0 30
michael@0 31 yield inspector.once("inspector-updated");
michael@0 32 });

mercurial