blob: d2149f70b578c40fe13adc6b9e2feb4acbfe46d0 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="linesClampTest"></div>
<script>
if (window.internals)
window.internals.settings.setAppleMailLinesClampEnabled(true)
description('Lines Clamp Parsing Test');
function testParsing(elementId, value, styleAttribute)
{
var div = document.getElementById(elementId);
div.style[styleAttribute] = value;
return div.style[styleAttribute];
}
shouldBeEqualToString('testParsing("linesClampTest", "2 1", "-webkit-lines-clamp")', '2 1');
shouldBeEqualToString('testParsing("linesClampTest", "1 1", "-webkit-lines-clamp")', '1 1');
shouldBeEqualToString('testParsing("linesClampTest", "20% 4", "-webkit-lines-clamp")', '20% 4');
shouldBeEqualToString('testParsing("linesClampTest", "3 30%", "-webkit-lines-clamp")', '3 30%');
shouldBeEqualToString('testParsing("linesClampTest", "50% 60%", "-webkit-lines-clamp")', '50% 60%');
shouldBeEqualToString('testParsing("linesClampTest", "1 3 foo", "-webkit-lines-clamp")', '1 3 foo');
shouldBeEqualToString('testParsing("linesClampTest", "inherit", "-webkit-lines-clamp")', 'inherit');
shouldBeEqualToString('testParsing("linesClampTest", "1 a", "-webkit-lines-clamp")', '1 a');
shouldBeEqualToString('testParsing("linesClampTest", "none", "-webkit-lines-clamp")', 'none');
// The following are invalid and should get ignored.
shouldBeEqualToString('testParsing("linesClampTest", "foo", "-webkit-lines-clamp")', 'none');
shouldBeEqualToString('testParsing("linesClampTest", "1 2 3", "-webkit-lines-clamp")', 'none');
shouldBeEqualToString('testParsing("linesClampTest", "a 1", "-webkit-lines-clamp")', 'none');
shouldBeEqualToString('testParsing("linesClampTest", "abc123", "-webkit-lines-clamp")', 'none');
shouldBeEqualToString('testParsing("linesClampTest", "-1", "-webkit-lines-clamp")', 'none');
shouldBeEqualToString('testParsing("linesClampTest", "50px", "-webkit-lines-clamp")', 'none');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>