browser/devtools/markupview/test/browser_markupview_search_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.

     1 /* vim: set ts=2 et sw=2 tw=80: */
     2 /* Any copyright is dedicated to the Public Domain.
     3  http://creativecommons.org/publicdomain/zero/1.0/ */
     5 "use strict";
     7 // Test that searching for nodes using the selector-search input expands and
     8 // selects the right nodes in the markup-view, even when those nodes are deeply
     9 // nested (and therefore not attached yet when the markup-view is initialized).
    11 const TEST_URL = TEST_URL_ROOT + "doc_markup_search.html";
    13 let test = asyncTest(function*() {
    14   let {inspector, toolbox} = yield addTab(TEST_URL).then(openInspector);
    16   ok(!getContainerForRawNode("em", inspector),
    17     "The <em> tag isn't present yet in the markup-view");
    19   // Searching for the innermost element first makes sure that the inspector
    20   // back-end is able to attach the resulting node to the tree it knows at the
    21   // moment. When the inspector is started, the <body> is the default selected
    22   // node, and only the parents up to the ROOT are known, and its direct children
    23   info("searching for the innermost child: <em>");
    24   let updated = inspector.once("inspector-updated");
    25   searchUsingSelectorSearch("em", inspector);
    26   yield updated;
    28   ok(getContainerForRawNode("em", inspector),
    29     "The <em> tag is now imported in the markup-view");
    30   is(inspector.selection.node, getNode("em"),
    31     "The <em> tag is the currently selected node");
    33   info("searching for other nodes too");
    34   for (let node of ["span", "li", "ul"]) {
    35     let updated = inspector.once("inspector-updated");
    36     searchUsingSelectorSearch(node, inspector);
    37     yield updated;
    38     is(inspector.selection.node, getNode(node),
    39       "The <" + node + "> tag is the currently selected node");
    40   }
    41 });

mercurial