mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
Tests: Resync imported WPT tests
This commit is contained in:
committed by
Shannon Booth
parent
dda3cb99b7
commit
504a8e6d1d
Notes:
github-actions[bot]
2026-04-04 21:38:15 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/504a8e6d1d3 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8776 Reviewed-by: https://github.com/shannonbooth ✅
@@ -15,6 +15,22 @@
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="grid-to-block" style="display: grid">
|
||||
<div style="display: contents">
|
||||
<div style="display: contents">
|
||||
<button>button1</button>
|
||||
<button id="deblockified">button2</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="block-to-grid" style="display: block">
|
||||
<div style="display: contents">
|
||||
<div style="display: contents">
|
||||
<button>button1</button>
|
||||
<button id="blockified">button2</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function display(el) {
|
||||
return getComputedStyle(el).display;
|
||||
@@ -31,4 +47,26 @@ test(function() {
|
||||
assert_equals(display(child), "block", "Grid child should get blockified");
|
||||
assert_equals(display(grandChild), "inline", "Grid grand-child should get un-blockified when its parent's display stops being `contents`");
|
||||
}, "Dynamic changes to `display` causing blockification of children are handled correctly");
|
||||
|
||||
test(() => {
|
||||
let gridToBlock = document.getElementById("grid-to-block");
|
||||
let itemGrandChild = document.getElementById("deblockified");
|
||||
|
||||
assert_equals(display(gridToBlock), "grid", "Container should be a grid");
|
||||
assert_equals(display(itemGrandChild), "block", "Item should have been blockified");
|
||||
gridToBlock.style.display = "block";
|
||||
assert_equals(display(gridToBlock), "block", "Container should become a block");
|
||||
assert_equals(display(itemGrandChild), "inline-block", "Item should get de-blockified");
|
||||
}, "Dynamic changes to `display` from `grid` to `block` should cause children to get de-blockified despite being children of `display: contents` elements");
|
||||
|
||||
test(() => {
|
||||
let blockToGrid = document.getElementById("block-to-grid");
|
||||
let itemGrandChild = document.getElementById("blockified");
|
||||
|
||||
assert_equals(display(blockToGrid), "block", "Container should be a block");
|
||||
assert_equals(display(itemGrandChild), "inline-block", "Item should not have been blockified");
|
||||
blockToGrid.style.display = "grid";
|
||||
assert_equals(display(blockToGrid), "grid", "Container should become a grid");
|
||||
assert_equals(display(itemGrandChild), "block", "Item should get blockified");
|
||||
}, "Dynamic changes to `display` from `block` to `grid` should cause children to get blockified despite being children of `display: contents` elements")
|
||||
</script>
|
||||
|
||||
@@ -1,42 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Display: first-line and first-letter pseudo-elements</title>
|
||||
<title>CSS Display: first-line pseudo-element</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/css-display-3/#placement">
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#t1::first-letter { float: left; display: flex; font-size: 30px }
|
||||
#t2::first-letter { float: left; font-size: 30px }
|
||||
#t3::first-letter { display: flex; font-size: 30px }
|
||||
#t4::first-letter { font-size: 30px }
|
||||
#t5::first-line { float: left; display: flex; font-size: 30px }
|
||||
#t6::first-line { float: left; font-size: 30px }
|
||||
#t7::first-line { display: flex; font-size: 30px }
|
||||
#t8::first-line { font-size: 30px }
|
||||
#t1::first-line { float: left; display: flex; font-size: 30px }
|
||||
#t2::first-line { float: left; font-size: 30px }
|
||||
#t3::first-line { display: flex; font-size: 30px }
|
||||
#t4::first-line { font-size: 30px }
|
||||
</style>
|
||||
<div id="t1">First letter is float and flex.</div>
|
||||
<div id="t2">First letter is float but not flex.</div>
|
||||
<div id="t3">First letter is flex but not float.</div>
|
||||
<div id="t4">First letter not float or flex.</div>
|
||||
<div id="t5">First line is float and flex.</div>
|
||||
<div id="t6">First line is float but not flex.</div>
|
||||
<div id="t7">First line is flex but not float.</div>
|
||||
<div id="t8">First line is not float or flex.</div>
|
||||
<div id="t1">First line is float and flex.</div>
|
||||
<div id="t2">First line is float but not flex.</div>
|
||||
<div id="t3">First line is flex but not float.</div>
|
||||
<div id="t4">First line is not float or flex.</div>
|
||||
<script>
|
||||
function getFirstLetterDisplayFor(id) {
|
||||
return window.getComputedStyle(document.getElementById(id), "::first-letter").display;
|
||||
}
|
||||
function getFirstLineDisplayFor(id) {
|
||||
return window.getComputedStyle(document.getElementById(id), "::first-line").display;
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(getFirstLetterDisplayFor("t1"), "block");
|
||||
assert_equals(getFirstLetterDisplayFor("t2"), "block");
|
||||
assert_equals(getFirstLetterDisplayFor("t3"), "inline");
|
||||
assert_equals(getFirstLetterDisplayFor("t4"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t5"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t6"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t7"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t8"), "inline");
|
||||
}, "display of first-letter and first-line");
|
||||
assert_equals(getFirstLineDisplayFor("t1"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t2"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t3"), "inline");
|
||||
assert_equals(getFirstLineDisplayFor("t4"), "inline");
|
||||
}, "display of first-line");
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user