<!DOCTYPE html>
<html>
<style>
.container {
    position: relative;
    background-color: pink;
    outline: 1px solid black;
    display: inline-block;
}
.flexbox {
    display: flex;
    background-color: grey;
    margin: 10px 20px 30px 40px;
}
.title {
    margin-top: 1em;
}
.ltr {
    direction: ltr;
}
.rtl {
    direction: rtl;
}
.horizontal-tb {
    writing-mode: horizontal-tb;
}
.vertical-rl {
    writing-mode: vertical-rl;
}
.vertical-lr {
    writing-mode: vertical-lr;
}
.row {
    flex-flow: row;
}
.row-reverse {
    flex-flow: row-reverse;
}
.column {
    flex-flow: column;
}
.column-reverse {
    flex-flow: column-reverse;
}
.flexbox > div {
    margin: 13px 2px 17px 8px;
    background-color: blue;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.flexbox')">
<div id=log></div>

<script>

var writingModes = ['horizontal-tb', 'vertical-lr', 'vertical-rl'];
var flexFlows = ['row', 'column', 'row-reverse', 'column-reverse'];
var directions = ['rtl', 'ltr'];

writingModes.forEach(function(writingMode) {
    flexFlows.forEach(function(flexFlow) {
        directions.forEach(function(direction) {
            var flexboxClassName = writingMode + ' ' + direction + ' ' + flexFlow;
            var title = document.createElement('div');
            title.className = 'title';
            title.innerHTML = flexboxClassName;
            document.body.appendChild(title);

            var flexboxExpectations = 'data-offset-x="40" data-offset-y="10"';
            var flexItemExpectations = 'data-expected-width="20" data-expected-height="20" data-offset-x="48" data-offset-y="23"';

            var container = document.createElement('div');
            container.className = 'container';
            container.setAttribute('data-expected-width', 90);
            container.setAttribute('data-expected-height', 90);

            container.innerHTML = '<div class="flexbox ' + flexboxClassName + '" ' + flexboxExpectations + '>\n' +
                '<div style="flex: 1 auto; width: 20px; height: 20px;" ' + flexItemExpectations + '></div>\n' +
            '</div>';

            document.body.appendChild(container);
        })
    })
})
</script>
</body>
</html>
