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.
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 // Tests for matched selector texts in the computed view
9 let test = asyncTest(function*() {
10 yield addTab("data:text/html,<div style='color:blue;'></div>");
12 info("Opening the computed view");
13 let {toolbox, inspector, view} = yield openComputedView();
15 info("Selecting the test node");
16 yield selectNode("div", inspector);
18 info("Checking the color property view");
19 let propertyView = getPropertyView(view, "color");
20 ok(propertyView, "found PropertyView for color");
21 is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors is true");
23 info("Expanding the matched selectors");
24 propertyView.matchedExpanded = true;
25 yield propertyView.refreshMatchedSelectors();
27 let span = propertyView.matchedSelectorsContainer.querySelector("span.rule-text");
28 ok(span, "Found the first table row");
30 let selector = propertyView.matchedSelectorViews[0];
31 ok(selector, "Found the first matched selector view");
32 });
34 function getPropertyView(computedView, name) {
35 let propertyView = null;
36 computedView.propertyViews.some(function(view) {
37 if (view.name == name) {
38 propertyView = view;
39 return true;
40 }
41 return false;
42 });
43 return propertyView;
44 }