Files
firefox/testing/web-platform/tests/html/rendering/widgets/button-layout/flex.html
T
Kent Tamura 590bbbc965 Bug 1613666 [wpt PR 21634] - <button> should support display:inline-grid/grid/inline-flex/flex correctly, a=testonly
Automatic update from web-platform-tests
<button> should support display:inline-grid/grid/inline-flex/flex correctly

If 'display' property value is one of 'inline-grid', 'grid',
'inline-flex', and 'flex', <button> doesn't use LayoutButton.

This behavior follows https://html.spec.whatwg.org/C/#button-layout .

Bug: 700029
Change-Id: I017734ad773eed6531e0dc665f80b99e8f14d1d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040796
Commit-Queue: Kent Tamura <[email protected]>
Reviewed-by: Ian Kilpatrick <[email protected]>
Cr-Commit-Position: refs/heads/master@{#739189}

--

wpt-commits: ed47ca6173bf14c901e9c21e7a8d440876aec59a
wpt-pr: 21634
2020-02-14 19:09:01 +00:00

62 lines
1.9 KiB
HTML

<!doctype html>
<title>button with flex/inline-flex</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#inline-flex { display: inline-flex }
#flex { display: flex }
#ref > div { display: flex }
#flexstart {
border: none;
padding: 0;
display: flex;
align-items: flex-start;
height: 3em;
}
#stretch {
border: none;
padding: 0;
display: flex;
align-items: stretch;
height: 3em;
}
</style>
<button id=inline-flex><div>1</div><div>2</div><div>3</div><div>4</div></button>
<button id=flex><div>1</div><div>2</div><div>3</div><div>4</div></button>
<button id=ref><div><div>1</div><div>2</div><div>3</div><div>4</div></div></button>
<div><button id="flexstart"><span id="flexstart-item">abc</span></button></div>
<div><button id="stretch"><span id="stretch-item">abc</span></button></div>
<script>
const ref = document.getElementById('ref');
const expectedWidth = ref.clientWidth;
const expectedHeight = ref.clientHeight;
for (const elm of [document.getElementById('inline-flex'),
document.getElementById('flex')]) {
test(() => {
// check that flex is supported
const flexValue = elm.id;
assert_equals(getComputedStyle(elm).display, flexValue, `${flexValue} is not supported`);
const width = elm.clientWidth;
const height = elm.clientHeight;
assert_equals(width, expectedWidth, 'clientWidth');
assert_equals(height, expectedHeight, 'clientHeight');
}, elm.id);
}
// crbug.com/700029
test(() => {
assert_equals(document.getElementById('flexstart').offsetTop,
document.getElementById('flexstart-item').offsetTop);
}, 'align-items:flex-start should work');
// crbug.com/1004163
test(() => {
assert_equals(document.getElementById('stretch').offsetHeight,
document.getElementById('stretch-item').offsetHeight);
}, 'align-items:stretch should work');
</script>