browser/devtools/markupview/test/browser_markupview_textcontent_edit_01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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