Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Flexible Box Layout Module Level 1: stretch() in flex-basis and flex</title>
<meta name="assert" content="flex-basis accepts the stretch() value of 'width', and so does the flex shorthand.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<script src="/css/support/shorthand-testcommon.js"></script>
</head>
<body>
<div id="target" style="font-size: 20px"></div>
<script>
test_valid_value("flex-basis", "stretch(10px)");
test_valid_value("flex-basis", "stretch(10%)");
test_valid_value("flex-basis", "stretch(calc(10% - 0.5em))");
test_invalid_value("flex-basis", "stretch(-10px)");
test_invalid_value("flex-basis", "stretch(auto)");
test_invalid_value("flex-basis", "stretch()");
test_computed_value("flex-basis", "stretch(10px)");
test_computed_value("flex-basis", "stretch(20%)");
test_computed_value("flex-basis", "stretch(calc(10px + 0.5em))", "stretch(20px)");
test_shorthand_value('flex', '1 stretch(10px)', {
'flex-grow': '1',
'flex-shrink': '1',
'flex-basis': 'stretch(10px)'
});
test_shorthand_value('flex', 'stretch(10%) 2 3', {
'flex-grow': '2',
'flex-shrink': '3',
'flex-basis': 'stretch(10%)'
});
</script>
</body>
</html>