mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-07 11:48:19 +02:00
Ideally nsDateTimeControlFrame should / could inherit from nsTextControlFrame, but this should do for now. Test also covers the previous patch. Differential Revision: https://phabricator.services.mozilla.com/D110076
51 lines
1.3 KiB
HTML
51 lines
1.3 KiB
HTML
<!doctype html>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<style>
|
|
#container * {
|
|
white-space: nowrap;
|
|
appearance: none;
|
|
}
|
|
input[type=date] {
|
|
/* date by default uses a monospace font, which might have different metrics */
|
|
font: -moz-field;
|
|
}
|
|
.small-font * {
|
|
font-size: 8px !important; /* important to override rule above */
|
|
}
|
|
.no-padding * {
|
|
padding: 0;
|
|
}
|
|
</style>
|
|
<div id="container">
|
|
<input>
|
|
<input type=date>
|
|
<button>Foo</button>
|
|
<select><option>Foo</option></select>
|
|
</div>
|
|
<script>
|
|
function testHeightMatches(desc) {
|
|
let commonHeight = null;
|
|
let commonTop = null;
|
|
for (let element of document.querySelectorAll("#container > *")) {
|
|
let rect = element.getBoundingClientRect();
|
|
if (commonHeight === null) {
|
|
commonHeight = rect.height;
|
|
commonTop = rect.top;
|
|
}
|
|
is(rect.height, commonHeight, `Height of the controls should match for ${element.outerHTML}${desc}`);
|
|
is(rect.top, commonTop, `Top of the controls should match for ${element.outerHTML}${desc}`);
|
|
}
|
|
}
|
|
|
|
const container = document.getElementById("container");
|
|
|
|
testHeightMatches("");
|
|
|
|
container.className = "no-padding";
|
|
|
|
testHeightMatches(" without padding");
|
|
|
|
container.className = "small-font";
|
|
|
|
testHeightMatches(" with an small font");
|
|
</script>
|