-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle border widths and shadow dom (#237)
* add shadow-dom test * fix(shadowdom): add test and attempt support * working on new test suite * test new test suite on ci * finished borders test case * handle border widths * optimize * cleanup lil bit
- Loading branch information
Showing
4 changed files
with
282 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/web-platform/css/cssom-view/scrollIntoView-shadow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE HTML> | ||
<script src="/node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<title>Check End Position of scrollIntoView of shadow elements</title> | ||
<div id="container"> | ||
<div id="space1" style="height: 2000px; width: 2000px;background-color: yellow"> | ||
</div> | ||
<div id="shadow"></div> | ||
<div id="space2" style="height: 2000px; width: 2000px;background-color: blue"> | ||
</div> | ||
</div> | ||
<script> | ||
add_completion_callback(() => document.getElementById("container").remove()); | ||
|
||
test(t => { | ||
var shadow = document.getElementById("shadow"); | ||
var shadowRoot = shadow.attachShadow({ mode: "open" }); | ||
var shadowDiv = document.createElement("div"); | ||
shadowDiv.style.height = "200px"; | ||
shadowDiv.style.width = "200px"; | ||
shadowDiv.style.backgroundColor = "green"; | ||
shadowRoot.appendChild(shadowDiv); | ||
|
||
window.scrollTo(0, 0); | ||
var expected_x = shadowDiv.offsetLeft; | ||
var expected_y = shadowDiv.offsetTop; | ||
assert_not_equals(window.scrollX, expected_x); | ||
assert_not_equals(window.scrollY, expected_y); | ||
scrollIntoView(shadowDiv, {block: "start", inline: "start"}); | ||
assert_approx_equals(window.scrollX, expected_x, 1); | ||
assert_approx_equals(window.scrollY, expected_y, 1); | ||
}, "scrollIntoView should behave correctly if applies to shadow dom elements"); | ||
</script> |
Oops, something went wrong.