зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1571650: Add test for AnonymousContent::SetStyle(). r=smaug
In this patch, creates a test to confirm whether the AnonymousContent.setStyle() works correctly. Differential Revision: https://phabricator.services.mozilla.com/D41928 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c6a47f400c
Коммит
461170519e
|
@ -257,6 +257,7 @@ skip-if = fission # Crashes: @ mozilla::dom::ContentParent::RecvDetachBrowsingCo
|
|||
skip-if = headless # Bug 1405867
|
||||
[test_anonymousContent_insert.html]
|
||||
[test_anonymousContent_manipulate_content.html]
|
||||
[test_anonymousContent_set_style.html]
|
||||
[test_anonymousContent_style_csp.html]
|
||||
[test_appname_override.html]
|
||||
[test_async_setTimeout_stack.html]
|
||||
|
|
|
@ -46,7 +46,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1020244
|
|||
let members = ["getTextContentForElement", "setTextContentForElement",
|
||||
"getAttributeForElement", "setAttributeForElement",
|
||||
"removeAttributeForElement", "getCanvasContext",
|
||||
"setAnimationForElement"];
|
||||
"setAnimationForElement", "setStyle"];
|
||||
for (let member of members) {
|
||||
ok(member in anonymousContent, "AnonymousContent object defines " + member);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1571650
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1571650 - Test AnonymousContent.setStyle() API</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1571650">Mozilla Bug 1571650</a>
|
||||
<script type="application/javascript">
|
||||
const chromeDocument = SpecialPowers.wrap(document);
|
||||
|
||||
info("Set z-index to anonymous content");
|
||||
const div = document.createElement("div");
|
||||
div.setAttribute("class", "set-style-test");
|
||||
const anonymousContent = chromeDocument.insertAnonymousContent(div);
|
||||
anonymousContent.setStyle("z-index", 3);
|
||||
|
||||
info("Test the element which became to anonymous");
|
||||
const mozCustomContentContainerEl =
|
||||
[...SpecialPowers.InspectorUtils.getChildrenForNode(document.documentElement, true)]
|
||||
.find(n => n.classList && n.classList.contains("moz-custom-content-container"));
|
||||
|
||||
const targetEl = mozCustomContentContainerEl.querySelector(".set-style-test");
|
||||
ok(targetEl, "Element which became to anonymous is found");
|
||||
is(targetEl.style.zIndex, "3", "z-index is correct");
|
||||
|
||||
chromeDocument.removeAnonymousContent(anonymousContent);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче