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