Commit 6f345381 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[css-grid] Migrate empty-grid.html to WPT

BUG=767015, 1063749
R=svillar@chromium.org

Change-Id: I635081a2f98896e52d8f5aa1c95dc1f1d9836f65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148072
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarManuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#758859}
parent e4f9a4f5
<!DOCTYPE html> <!DOCTYPE html>
<link href="resources/grid.css" rel="stylesheet"> <title>CSS Grid: empty grid without explicit tracks.</title>
<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel="stylesheet"> <link rel="author" title="Sergio Villar" href="mailto:svillar@igalia.com"/>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos"/>
<link rel="issue" href="https://crrev.com/562167"/>
<meta name="assert" content="Test ensures that the grids with no in-flow items are actually empty."/>
<link href="/css/support/grid.css" rel="stylesheet"/>
<link href="/css/support/width-keyword-classes.css" rel="stylesheet"/>
<link href="/fonts/ahem.css" rel="stylesheet" type="text/css"/>
<style> <style>
.gridWithAbsolutePositionedItem { .gridWithAbsolutePositionedItem {
/* Ensures that the grid container is the containing block of the absolutely positioned grid children. */ /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
position: relative; position: relative;
} }
.grid { .grid {
grid-auto-columns: 200px; grid-auto-columns: 200px;
grid-auto-rows: 200px; grid-auto-rows: 200px;
} }
.item { .item {
position: absolute; position: absolute;
font: 10px/1 Ahem; font: 10px/1 Ahem;
} }
</style> </style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script> <script>
function addRemoveItem() function addRemoveItem()
{ {
var gridItem = document.createElement("div"); var gridItem = document.createElement("div");
gridItem.style.width = "100px"; gridItem.style.width = "100px";
gridItem.style.height = "100px"; gridItem.style.height = "100px";
gridItem.style.backgroundColor = "red"; gridItem.style.backgroundColor = "red";
var gridElement = document.getElementById("dynamicGrid"); var gridElement = document.getElementById("dynamicGrid");
gridElement.appendChild(gridItem); gridElement.appendChild(gridItem);
gridElement.removeChild(gridItem); gridElement.removeChild(gridItem);
} }
setup({ explicit_done: true });
function doTest() { function doTest() {
addRemoveItem(); addRemoveItem();
checkLayout(".grid"); checkLayout(".grid");
} }
</script> </script>
<script src="../../resources/check-layout.js"></script>
<body onload="doTest()">
<p>This test checks that grids with no in-flow items are actually empty.</p> <body onload="document.fonts.ready.then(() => { doTest(); })">
<div class="grid min-content" data-expected-width="0" data-expected-height="0"></div> <div class="grid min-content" data-expected-width="0" data-expected-height="0"></div>
<div class="grid min-content gridWithAbsolutePositionedItem" data-expected-width="0" data-expected-height="0"> <div class="grid min-content gridWithAbsolutePositionedItem" data-expected-width="0" data-expected-height="0">
<div class="item" data-expected-width="40" data-expected-height="10">XXXX</div> <div class="item" data-expected-width="40" data-expected-height="10">XXXX</div>
</div> </div>
<div id="dynamicGrid" class="grid min-content" data-expected-width="0" data-expected-height="0"></div> <div id="dynamicGrid" class="grid min-content" data-expected-width="0" data-expected-height="0"></div>
......
This test checks that grids with no in-flow items are actually empty.
PASS
XXXX
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment