Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html>
<head>
<title>CSSOM Test: Numeric Factory Functions for font relative length</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<meta name="assert" content="CSS factory functions produce expected CSSUnitValue">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
"use strict";
let units = [
"cap",
"ch",
"em",
"ex",
"ic",
"lh",
"rcap",
"rch",
"rem",
"rex",
"ric",
"rlh"
];
let counter = 1;
for (let unit of units) {
test(function(){
let length = CSS[unit](counter);
assert_true(length instanceof CSSUnitValue);
assert_equals(length.value, counter);
assert_equals(length.unit, unit);
counter++;
}, `CSS.${unit}() produces ${unit} length`);
}
</script>
</body>
</html>