Skip to content

Commit af3dc21

Browse files
authored
HTML: test fieldset min-/max-content calculation
See whatwg/html#3934
1 parent 85fca50 commit af3dc21

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<title>fieldset calculating min-/max-content</title>
3+
<script src=/resources/testharness.js></script>
4+
<script src=/resources/testharnessreport.js></script>
5+
<style>
6+
fieldset { margin: 0; padding: 0; }
7+
.min-content { width: 0; }
8+
legend { padding: 0; }
9+
fieldset, #ref-max-content, #ref-min-content { float: left; clear: left; border: 1px solid; }
10+
#log { clear: left; }
11+
</style>
12+
<fieldset class=max-content><legend>foo fooo</legend>x x</fieldset>
13+
<fieldset class=max-content><legend>x x</legend>foo fooo</fieldset>
14+
<div id=ref-max-content>foo fooo</div>
15+
16+
<fieldset class=min-content><legend>foo fooo</legend>x x</fieldset>
17+
<fieldset class=min-content><legend>x x</legend>foo fooo</fieldset>
18+
<div id=ref-min-content>fooo</div>
19+
20+
<script>
21+
test(() => {
22+
const ref = document.querySelector('#ref-max-content');
23+
for (const e of document.querySelectorAll('.max-content')) {
24+
assert_equals(e.clientWidth, ref.clientWidth);
25+
}
26+
}, 'max-content');
27+
28+
test(() => {
29+
const ref = document.querySelector('#ref-min-content');
30+
for (const e of document.querySelectorAll('.min-content')) {
31+
assert_equals(e.clientWidth, ref.clientWidth);
32+
}
33+
}, 'min-content');
34+
</script>

0 commit comments

Comments
 (0)