зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481192 Part 2: Add test of computedstyle for pseudo elements of varying display types. r=emilio
Depends on D6730 Differential Revision: https://phabricator.services.mozilla.com/D6731 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
21a3477d68
Коммит
d8e0094e97
|
@ -23,6 +23,7 @@ support-files =
|
|||
file_getCSSStyleRules-alternate.html
|
||||
getCSSStyleRules-1.css
|
||||
getCSSStyleRules-2.css
|
||||
[test_getCSSStyleRules_pseudo.html]
|
||||
[test_getCSSPseudoElementNames.html]
|
||||
[test_getRelativeRuleLine.html]
|
||||
[test_get_all_style_sheets.html]
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test getCSSStyleRules for pseudo elements</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
|
||||
<style>
|
||||
#block:before {
|
||||
display: block;
|
||||
content: ":before";
|
||||
}
|
||||
#block:after {
|
||||
display: block;
|
||||
content: ":after";
|
||||
}
|
||||
|
||||
#table:before {
|
||||
display: table;
|
||||
content: ":before";
|
||||
}
|
||||
#table:after {
|
||||
display: table;
|
||||
content: ":after";
|
||||
}
|
||||
|
||||
#flex:before {
|
||||
display: flex;
|
||||
content: ":before";
|
||||
}
|
||||
#flex:after {
|
||||
display: flex;
|
||||
content: ":after";
|
||||
}
|
||||
|
||||
#grid:before {
|
||||
display: grid;
|
||||
content: ":before";
|
||||
}
|
||||
#grid:after {
|
||||
display: grid;
|
||||
content: ":after";
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="block">block pseudos</div>
|
||||
<div id="table">table pseudos</div>
|
||||
<div id="flex">flex pseudos</div>
|
||||
<div id="grid">grid pseudos</div>
|
||||
|
||||
<script>
|
||||
const InspectorUtils = SpecialPowers.InspectorUtils;
|
||||
|
||||
function checkPseudoStyleForId(id) {
|
||||
let element = document.getElementById(id);
|
||||
|
||||
let beforeRules = InspectorUtils.getCSSStyleRules(element, ":before");
|
||||
is (beforeRules.length, 1, "Element " + id + ":before has expected number of rules.");
|
||||
let beforeDecl = beforeRules[0].style;
|
||||
is (beforeDecl.content, '":before"', "Element " + id + ":before has expected style content.");
|
||||
|
||||
let afterRules = InspectorUtils.getCSSStyleRules(element, ":after");
|
||||
is (afterRules.length, 1, "Element " + id + ":after has expected number of rules.");
|
||||
let afterDecl = afterRules[0].style;
|
||||
is (afterDecl.content, '":after"', "Element " + id + ":after has expected style content.");
|
||||
}
|
||||
|
||||
let idsToCheck = [
|
||||
"block",
|
||||
"table",
|
||||
"flex",
|
||||
"grid",
|
||||
];
|
||||
|
||||
for (let id of idsToCheck) {
|
||||
checkPseudoStyleForId(id);
|
||||
}
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче