Files
firefox/testing/web-platform/tests/html/rendering/widgets/button-layout/flex.html
T
Simon Pieters f5b966bb6d Bug 1551774 [wpt PR 14824] - HTML: Tests for button layout, a=testonly
Automatic update from web-platform-tests
HTML: Tests for button layout

Follows https://github.com/whatwg/html/pull/4143.
--

wpt-commits: 849c1240850a4749e58bd87fe9f7233047cfbad4
wpt-pr: 14824
2019-06-19 11:05:17 -07:00

30 lines
1.1 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 }
</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>
<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);
}
</script>