Skip to content

Commit

Permalink
HTML: test display and box-sizing UA style for form controls
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Nov 18, 2019
1 parent ee89390 commit 0d6bde6
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion html/rendering/non-replaced-elements/form-controls/resets.html
Expand Up @@ -33,9 +33,29 @@
input[type=reset i], input[type=button i], input[type=submit i], button {
text-align: center;
}
input[type=radio i], input[type=checkbox i], input[type=reset i], input[type=button i],
input[type=submit i], input[type=color i], input[type=search i], select, button {
box-sizing: border-box;
}
input, button {
display: inline-block;
}
/* in spec prose: */ select, textarea, meter, progress {
display: inline-block;
}
input[type=hidden i] { display: none !important; }
marquee {
text-align: initial;
}
table { display: table; }
caption { display: table-caption; }
colgroup, colgroup[hidden] { display: table-column-group; }
col, col[hidden] { display: table-column; }
thead, thead[hidden] { display: table-header-group; }
tbody, tbody[hidden] { display: table-row-group; }
tfoot, tfoot[hidden] { display: table-footer-group; }
tr, tr[hidden] { display: table-row; }
td, th { display: table-cell; }
table {
text-indent: initial;
}
Expand Down Expand Up @@ -83,7 +103,9 @@
'text-transform',
'text-indent',
'text-shadow',
'text-align'];
'text-align',
'display',
'box-sizing'];
const refs = document.getElementById('refs');
for (const el of document.querySelectorAll('#tests > *')) {
const clone = fakeClone(el);
Expand All @@ -98,6 +120,16 @@
const testStyle = getComputedStyle(testEl);
const refStyle = getComputedStyle(refEl);
for (const prop of props) {
// Don't test display for some elements.
// TODO(zcorpan): https://github.com/whatwg/html/issues/4093
// TODO(zcorpan): https://github.com/whatwg/html/issues/5063
if (prop === 'display' &&
(testEl.localName === 'optgroup' ||
testEl.localName === 'option' ||
testEl.localName === 'marquee')
) {
continue;
}
test(() => {
assert_equals(testStyle.getPropertyValue(prop), refStyle.getPropertyValue(prop));
}, `${testNameContext(testEl)} - ${prop}`);
Expand Down

0 comments on commit 0d6bde6

Please sign in to comment.