Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<link rel="author" title="sam@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/parsing-testcommon.js"></script>
<div id=target></div>
<script>
test_valid_value('width', 'random(0px, 100px)');
test_valid_value('width', 'random(0px, 100px, by 50px)');
test_valid_value('width', 'random(--foo, 0px, 100px)');
test_valid_value('width', 'random(--foo per-element, 0px, 100px)');
test_valid_value('width', 'random(per-element --foo, 0px, 100px)', 'random(--foo per-element, 0px, 100px)');
test_valid_value('width', 'random(--foo, 0px, 100px, by 50px)');
test_valid_value('width', 'random(--foo per-element, 0px, 100px, by 50px)');
test_valid_value('width', 'random(per-element --foo, 0px, 100px, by 50px)', 'random(--foo per-element, 0px, 100px, by 50px)');
// Test out of order.
test_valid_value('width', 'random(100px, 0px)');
// Test negative values
test_valid_value('width', 'random(-100px, -10px)');
// Test mixed units.
test_valid_value('width', 'random(1em, 200rem)');
// Test nested expressions
test_valid_value('width', 'random(10 * 100px, 200em / 2)', 'random(1000px, 100em)');
// Test nested in expressions
test_valid_value('width', 'calc(2 * random(0px, 100px))');
// Test other types
test_valid_value('max-lines', 'random(25, 50)');
test_valid_value('max-lines', 'random(25, 50, by 5)');
test_valid_value('scale', 'random(0.5, 2.5)');
test_valid_value('scale', 'random(0.5, 2.5, by 0.1)');
test_valid_value('rotate', 'random(25deg, 1turn)', 'random(25deg, 360deg)');
test_valid_value('rotate', 'random(25deg, 1turn, by 5deg)', 'random(25deg, 360deg, by 5deg)');
test_valid_value('transition-delay', 'random(25ms, 50s)', 'random(0.025s, 50s)');
test_valid_value('transition-delay', 'random(25ms, 50s, by 5s)', 'random(0.025s, 50s, by 5s)');
</script>