browser/devtools/styleinspector/test/browser_ruleview_content.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 ft=javascript 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 the rule-view content
     9 let test = asyncTest(function*() {
    10   yield addTab("data:text/html;charset=utf-8,browser_ruleview_ui.js");
    11   let {toolbox, inspector, view} = yield openRuleView();
    13   info("Creating the test document");
    14   let style = "" +
    15     "#testid {" +
    16     "  background-color: blue;" +
    17     "}" +
    18     ".testclass, .unmatched {" +
    19     "  background-color: green;" +
    20     "}";
    21   let styleNode = addStyle(content.document, style);
    22   content.document.body.innerHTML = "<div id='testid' class='testclass'>Styled Node</div>" +
    23                                     "<div id='testid2'>Styled Node</div>";
    25   yield testContentAfterNodeSelection(inspector, view);
    26 });
    28 function* testContentAfterNodeSelection(inspector, ruleView) {
    29   yield selectNode("#testid", inspector);
    30   is(ruleView.element.querySelectorAll("#noResults").length, 0,
    31     "After a highlight, no longer has a no-results element.");
    33   yield clearCurrentNodeSelection(inspector)
    34   is(ruleView.element.querySelectorAll("#noResults").length, 1,
    35     "After highlighting null, has a no-results element again.");
    37   yield selectNode("#testid", inspector);
    38   let classEditor = ruleView.element.children[2]._ruleEditor;
    39   is(classEditor.selectorText.querySelector(".ruleview-selector-matched").textContent,
    40     ".testclass", ".textclass should be matched.");
    41   is(classEditor.selectorText.querySelector(".ruleview-selector-unmatched").textContent,
    42     ".unmatched", ".unmatched should not be matched.");
    43 }

mercurial