blob: ada38768bed21168fc83385e133ccbc986333cbc [file] [log] [blame] [edit]
<!DOCTYPE html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<div id="testDiv"></div>
<script>
description("Tests assigning a calculated values to 'flex' CSS property.");
var testDiv = document.getElementById("testDiv");
shouldBeEmptyString("testDiv.style['flex']");
evalAndLog("testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3)'");
shouldBeEqualToString("testDiv.style['flex']", "calc(6) calc(6) 0%");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('flex')", "6 6 0%");
evalAndLog("testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(10% * 2)'");
shouldBeEqualToString("testDiv.style['flex']", "calc(6) calc(6) calc(20%)");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('flex')", "6 6 20%");
// Only a literal 0 is allowed for the flex-basis, so this should not apply a new value.
evalAndLog("testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(3 - 3)'");
shouldBeEqualToString("testDiv.style['flex']", "calc(6) calc(6) calc(20%)");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('flex')", "6 6 20%");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>