Wed, 31 Dec 2014 06:09:35 +0100
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 that searching for nodes using the selector-search input expands and |
michael@0 | 8 | // selects the right nodes in the markup-view, even when those nodes are deeply |
michael@0 | 9 | // nested (and therefore not attached yet when the markup-view is initialized). |
michael@0 | 10 | |
michael@0 | 11 | const TEST_URL = TEST_URL_ROOT + "doc_markup_search.html"; |
michael@0 | 12 | |
michael@0 | 13 | let test = asyncTest(function*() { |
michael@0 | 14 | let {inspector, toolbox} = yield addTab(TEST_URL).then(openInspector); |
michael@0 | 15 | |
michael@0 | 16 | ok(!getContainerForRawNode("em", inspector), |
michael@0 | 17 | "The <em> tag isn't present yet in the markup-view"); |
michael@0 | 18 | |
michael@0 | 19 | // Searching for the innermost element first makes sure that the inspector |
michael@0 | 20 | // back-end is able to attach the resulting node to the tree it knows at the |
michael@0 | 21 | // moment. When the inspector is started, the <body> is the default selected |
michael@0 | 22 | // node, and only the parents up to the ROOT are known, and its direct children |
michael@0 | 23 | info("searching for the innermost child: <em>"); |
michael@0 | 24 | let updated = inspector.once("inspector-updated"); |
michael@0 | 25 | searchUsingSelectorSearch("em", inspector); |
michael@0 | 26 | yield updated; |
michael@0 | 27 | |
michael@0 | 28 | ok(getContainerForRawNode("em", inspector), |
michael@0 | 29 | "The <em> tag is now imported in the markup-view"); |
michael@0 | 30 | is(inspector.selection.node, getNode("em"), |
michael@0 | 31 | "The <em> tag is the currently selected node"); |
michael@0 | 32 | |
michael@0 | 33 | info("searching for other nodes too"); |
michael@0 | 34 | for (let node of ["span", "li", "ul"]) { |
michael@0 | 35 | let updated = inspector.once("inspector-updated"); |
michael@0 | 36 | searchUsingSelectorSearch(node, inspector); |
michael@0 | 37 | yield updated; |
michael@0 | 38 | is(inspector.selection.node, getNode(node), |
michael@0 | 39 | "The <" + node + "> tag is the currently selected node"); |
michael@0 | 40 | } |
michael@0 | 41 | }); |