mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
Tests/LibWeb: Import some CSSOM WPT tests
This commit is contained in:
committed by
Andreas Kling
parent
13b7c26e9f
commit
d0646236ca
Notes:
github-actions[bot]
2024-11-13 10:08:08 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/d0646236ca6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2305
@@ -0,0 +1,34 @@
|
||||
<!doctype html>
|
||||
<title>{Element,Range}.prototype.getBoundingClientRect on SVG <tspan></title>
|
||||
<link rel="stylesheet" type="text/css" href="../../fonts/ahem.css">
|
||||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect">
|
||||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-range-getboundingclientrect">
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<svg>
|
||||
<text y="180" font-size="100" font-family="Ahem"
|
||||
fill="lightblue">X<tspan fill="blue">XX</tspan></text>
|
||||
</svg>
|
||||
<script>
|
||||
function check(object) {
|
||||
let rect = object.getBoundingClientRect();
|
||||
assert_equals(rect.left, 108, 'left');
|
||||
assert_equals(rect.top, 108, 'top');
|
||||
assert_equals(rect.width, 200, 'width');
|
||||
assert_equals(rect.height, 100, 'height');
|
||||
}
|
||||
async_test(t => {
|
||||
window.addEventListener("load", t.step_func_done(() => {
|
||||
let tspan = document.querySelector('tspan');
|
||||
check(tspan);
|
||||
}));
|
||||
}, document.title + ', Element');
|
||||
async_test(t => {
|
||||
window.addEventListener("load", t.step_func_done(() => {
|
||||
let tspan = document.querySelector('tspan');
|
||||
let range = new Range();
|
||||
range.selectNode(tspan);
|
||||
check(range);
|
||||
}));
|
||||
}, document.title + ', Range');
|
||||
</script>
|
||||
Reference in New Issue
Block a user