function testLineMatchesExpectedValues(line, values, lineIndex, flexIndex) {
if (typeof(values.growthState) != "undefined") {
is(line.growthState, values.growthState, "Flex index " + flexIndex + " line index " + lineIndex + " has expected growthState.");
}
if (typeof(values.crossStart) != "undefined") {
is(line.crossStart, values.crossStart, "Flex index " + flexIndex + " line index " + lineIndex + " has expected crossStart.");
}
if (typeof(values.crossSize) != "undefined") {
is(line.crossSize, values.crossSize, "Flex index " + flexIndex + " line index " + lineIndex + " has expected crossSize.");
}
if (typeof(values.itemCount) != "undefined") {
is(line.getItems().length, values.itemCount, "Flex index " + flexIndex + " line index " + lineIndex + " has expected number of items.");
}
}
function runTests() {
let expectedValues = [
// items don't fill container, no grow, shrink, or min-width
[{ crossStart: 0,
crossSize: 42,
itemCount: 2,
growthState: "growing" }],
[{ crossStart: 0,
crossSize: 42,
itemCount: 3,
growthState: "growing" }],
// items don't fill container, no grow, shrink, or min-width, with wrap and align-content:center -->
[{ crossStart: 13.5,
crossSize: 15,
itemCount: 2,
growthState: "growing" }],
[{ crossStart: 13.5,
crossSize: 15,
itemCount: 3,
growthState: "growing" }],
let children = document.body.children;
is(children.length, expectedValues.length, "Document has expected number of flex containers.");
for (let i = 0; i < children.length; ++i) {
let flex = children.item(i).getAsFlexContainer();
ok(flex, "Document child index " + i + " is a flex container.");
if (flex) {
let values = expectedValues[i];
let lines = flex.getLines();
is(lines.length, values.length, "Flex index " + i + " has expected number of lines.");
<!-- items don't fill container, no grow, shrink, or min-width -->
<f><c></c><d></d></f>
<f class="withZ"><c></c><d></d></f>
<!-- items don't fill container, no grow, shrink, or min-width, with wrap and align-content:center -->
<f class="wrap"style="align-content:center"><c></c><d></d></f>
<f class="withZ wrap"style="align-content:center"><c></c><d></d></f>
<!-- items don't fill container, with grow -->
<f><b></b><c></c><d></d></f>
<f class="withZ"><b></b><c></c><d></d></f>
<!-- items overfill container, with min-width, and sometimes with wrap -->
<f><b></b><d></d><d></d><d></d><b></b></f>
<f class="wrap"><b></b><d></d><d></d><d></d><b></b></f>
<f class="withZ"><b></b><d></d><d></d><d></d><b></b></f>
<f class="wrap withZ"><b></b><d></d><d></d><d></d><b></b></f>
<!-- items overfill container, with shrink and sometimes with wrap -->
<f><d></d><d></d><e></e></f>
<f class="wrap"><d></d><d></d><e></e></f>
<f class="withZ"><d></d><d></d><e></e></f>
<f class="wrap withZ"><d></d><d></d><e></e></f>
<!-- items overfill container, with wrap and different types of align-content -->
<f class="wrap"><b></b><c></c><d></d><e></e></f>
<f class="wrap"style="align-content:flex-start"><b></b><c></c><d></d><e></e></f>
<f class="wrap"style="align-content:flex-end"><b></b><c></c><d></d><e></e></f>
<f class="wrap"style="align-content:center"><b></b><c></c><d></d><e></e></f>
<f class="wrap"style="align-content:space-between"><b></b><c></c><d></d><e></e></f>
<f class="wrap"style="align-content:space-around"><b></b><c></c><d></d><e></e></f>
<!-- items overfill container, with wrap-reverse and different types of align-content -->
<f class="wrapReverse withZ"><b></b><c></c><d></d><e></e></f>
<f class="wrapReverse withZ"style="align-content:flex-start"><b></b><c></c><d></d><e></e></f>
<f class="wrapReverse withZ"style="align-content:flex-end"><b></b><c></c><d></d><e></e></f>
<f class="wrapReverse withZ"style="align-content:center"><b></b><c></c><d></d><e></e></f>
<f class="wrapReverse withZ"style="align-content:space-between"><b></b><c></c><d></d><e></e></f>
<f class="wrapReverse withZ"style="align-content:space-around"><b></b><c></c><d></d><e></e></f>
<!-- other strange types of flex containers -->
<f style="overflow:scroll"><d></d><d></d><e></e></f>
<f class="wrap"style="flex-direction:column; align-content:center"><c></c><d></d><c></c><d></d><e></e></f>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.