Bug 1085119 - Part 2: Add unit tests for css-logic row and column precedence r=tromey

MozReview-Commit-ID: 4zz7hFOQJAj
This commit is contained in:
Cosine 2017-08-31 16:49:29 -04:00
parent 91ae972521
commit f392faaf4d
2 changed files with 16 additions and 8 deletions

View File

@ -10,6 +10,8 @@
.inheritable-rule {
font-size: 15px;
}
/* Has to be on one line, is such for test */
.column-rule { font-size: 20px; } .column-rule { font-size: 25px; }
.uninheritable-rule {
background-color: #f06;
}
@ -62,7 +64,7 @@
</div>
<!-- Matched checks -->
<div id="matched-parent" class="external-rule inheritable-rule uninheritable-rule" style="color: red;">
<div id="matched-parent" class="external-rule inheritable-rule column-rule uninheritable-rule" style="color: red;">
<div id="matched-test-node" style="font-size: 10px" class="external-rule">
Here is the test node.
</div>

View File

@ -52,17 +52,23 @@ addTest(function testMatchedStyles() {
is(matched[0].rule.href, gInspectee.defaultView.location.href,
"Node style comes from this document");
is(matched[1].sourceText, ".inheritable-rule", "Second match comes from a rule");
is(matched[1].selector, ".inheritable-rule", "Second style has a selector");
is(matched[1].value, "15px", "Second match has the expected value");
is(matched[1].sourceText, ".column-rule",
"Second match comes from a rule");
is(matched[1].selector, ".column-rule",
"Second match comes from highest line number");
is(matched[1].value, "25px", "Second match comes from highest column");
is(matched[1].status, CssLogic.STATUS.PARENT_MATCH,
"Second match is from the parent");
"Second match is from the parent");
is(matched[1].rule.parentStyleSheet.href, null,
"Inline stylesheet shouldn't have an href");
"Inline stylesheet shouldn't have an href");
is(matched[1].rule.parentStyleSheet.nodeHref, gInspectee.defaultView.location.href,
"Inline stylesheet's nodeHref should match the current document");
"Inline stylesheet's nodeHref should match the current document");
ok(!matched[1].rule.parentStyleSheet.system,
"Inline stylesheet shouldn't be a system stylesheet.");
"Inline stylesheet shouldn't be a system stylesheet.");
// matched[2] is only there to test matched[1]; do not need to test
is(matched[3].value, "15px", "Third match has the expected value");
}).then(runNextTest));
});