summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-typed-om/factory-font-relative-length.html
blob: f7e41ee29768cde6a4ead585ebfdcd42d35ee525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!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">
    <link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#numeric-factory">
    <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>