summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-fonts/parsing/font-variant-serialization.html
blob: 04e4d926814fd5cfad07d2f1c0caf6514f554c7c (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: serialization of font-variant</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#propdef-font-variant">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1797146">
<meta name="assert" content="re-setting font-variant to its serialization should be idempotent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=target style=""></div>
<script>
test(function(){
    let div = document.getElementById("target");
    let sty = div.style;

    sty.font = "12px serif";
    v = sty.fontVariant;
    assert_in_array(v, ["", "normal"]);  // Accept either explicit 'normal' or empty.
    sty.fontVariant = v;
    assert_equals(sty.fontVariant, v);

    sty.font = "menu";
    v = sty.fontVariant;
    assert_in_array(v, ["", "normal"]);

    sty.font = "12px serif"
    sty.fontVariantNumeric = "tabular-nums";
    v = sty.fontVariant;
    assert_equals(v, "tabular-nums");
    sty.fontVariant = v;
    assert_equals(sty.fontVariant, v);

    sty.font = "menu"
    sty.fontVariantNumeric = "tabular-nums";
    v = sty.fontVariant;
    assert_equals(v, "tabular-nums");
    sty.fontVariant = v;
    assert_equals(sty.fontVariant, v);

    sty.font = "12px serif"
    sty.fontVariantNumeric = "tabular-nums";
    sty.fontVariantCaps = "small-caps";
    v = sty.fontVariant;
    sty.fontVariant = v;
    assert_equals(sty.fontVariant, v);

    sty.font = "menu"
    sty.fontVariantNumeric = "tabular-nums";
    sty.fontVariantCaps = "small-caps";
    v = sty.fontVariant;
    sty.fontVariant = v;
    assert_equals(sty.fontVariant, v);
}, "checking serialized value of font-variant");
</script>
</body>
</html>