mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision fe78f2a1ad48c1e0132634e957369d8d674e4258
This commit is contained in:
parent
871fe9306f
commit
f9b7afc45e
59 changed files with 1352 additions and 82 deletions
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Grid items work inside a button</title>
|
||||
<meta name="assert" content="When a button is set to display: grid, its children should flow into its grid cells">
|
||||
<link rel="author" title="Bryan Robinson" href="bryanlrobinson@gmail.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-containers">
|
||||
<style>
|
||||
.grid { display: grid; grid-template-columns: 100px 200px; border: 2px solid purple; box-sizing: border-box; }
|
||||
span { border: 1px dashed green; box-sizing: border-box; }
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
|
||||
<button class="grid" ><span class="item1" data-expected-width="100">item 1</span> <span class="item2" data-expected-width="200">item 2</span></button>
|
||||
|
||||
<script>
|
||||
checkLayout("[data-expected-width]")
|
||||
</script>
|
|
@ -0,0 +1,61 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: indefinite percentage in fit-content()</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid/#track-sizes" title="7.2.1. Track Sizes">
|
||||
<meta name="assert" content="Checks that an indefinite percentage in fit-content lets the grid container grow enough to contain the max-content contribution of its grid items.">
|
||||
<style>
|
||||
.container {
|
||||
width: 200px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.grid {
|
||||
display: inline-grid;
|
||||
background: blue;
|
||||
}
|
||||
.item {
|
||||
background: orange;
|
||||
}
|
||||
.item::before, .item::after {
|
||||
content: '';
|
||||
float: left;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
function clamp(value, min, max) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
const minContent = 50;
|
||||
const maxContent = 100;
|
||||
for (const percentage of [0, 50, 75, 100, 150]) {
|
||||
const container = document.createElement("div");
|
||||
container.className = "container";
|
||||
document.body.appendChild(container);
|
||||
const grid = document.createElement("div");
|
||||
grid.className = "grid";
|
||||
grid.style.gridTemplateColumns = `fit-content(${percentage}%)`;
|
||||
container.appendChild(grid);
|
||||
const item = document.createElement("div");
|
||||
item.className = "item";
|
||||
grid.appendChild(item);
|
||||
test(function() {
|
||||
const colSize = clamp(percentage * maxContent / 100, minContent, maxContent);
|
||||
const height = colSize < maxContent ? maxContent : minContent;
|
||||
assert_equals(item.offsetWidth, colSize, "Grid item width");
|
||||
assert_equals(item.offsetHeight, height, "Grid item height");
|
||||
assert_equals(grid.offsetWidth, maxContent, "Grid container width");
|
||||
assert_equals(grid.offsetHeight, height, "Grid container height");
|
||||
assert_equals(getComputedStyle(grid).gridTemplateColumns, colSize + "px",
|
||||
"Grid column size");
|
||||
}, `fit-content(${percentage}%)`);
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue