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 ft=javascript 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 | // Checking selector counts, matched rules and titles in the computed-view |
michael@0 | 8 | |
michael@0 | 9 | const {PropertyView} = devtools.require("devtools/styleinspector/computed-view"); |
michael@0 | 10 | const TEST_URI = TEST_URL_ROOT + "doc_matched_selectors.html"; |
michael@0 | 11 | |
michael@0 | 12 | let test = asyncTest(function*() { |
michael@0 | 13 | yield addTab(TEST_URI); |
michael@0 | 14 | let {toolbox, inspector, view} = yield openComputedView(); |
michael@0 | 15 | |
michael@0 | 16 | yield selectNode("#test", inspector); |
michael@0 | 17 | yield testMatchedSelectors(view); |
michael@0 | 18 | }); |
michael@0 | 19 | |
michael@0 | 20 | function* testMatchedSelectors(view) { |
michael@0 | 21 | info("checking selector counts, matched rules and titles"); |
michael@0 | 22 | |
michael@0 | 23 | is(getNode("#test"), view.viewedElement.rawNode(), |
michael@0 | 24 | "style inspector node matches the selected node"); |
michael@0 | 25 | |
michael@0 | 26 | let propertyView = new PropertyView(view, "color"); |
michael@0 | 27 | propertyView.buildMain(); |
michael@0 | 28 | propertyView.buildSelectorContainer(); |
michael@0 | 29 | propertyView.matchedExpanded = true; |
michael@0 | 30 | |
michael@0 | 31 | yield propertyView.refreshMatchedSelectors(); |
michael@0 | 32 | |
michael@0 | 33 | let numMatchedSelectors = propertyView.matchedSelectors.length; |
michael@0 | 34 | is(numMatchedSelectors, 6, "CssLogic returns the correct number of matched selectors for div"); |
michael@0 | 35 | is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors returns true"); |
michael@0 | 36 | } |