blob: 5100345a2c3d2deac1ee4655cdde7fcec97aa2b2 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="aspectRatioTest"></div>
<script>
description('CSS Aspect Ratio Parsing Test');
function testParsing(elementId, value, styleAttribute)
{
var div = document.getElementById(elementId);
div.style[styleAttribute] = value;
return div.style[styleAttribute];
}
shouldBeEqualToString('testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio")', '2/1');
shouldBeEqualToString('testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio")', '1/1');
shouldBeEqualToString('testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio")', '1/4');
shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio")', '1/2');
shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
shouldBeEqualToString('testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio")', 'inherit');
shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
// The following are invalid and should get ignored.
shouldBeEqualToString('testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio")', 'none');
shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio")', 'none');
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>