summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-typed-om/factory-absolute-length.html
blob: 5712ca99f8eb9c2363d4da3a7056fba481d3aa1e (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
60
61
62
63
64
<!DOCTYPE html>
<html>
    <head>
        <title>CSSOM Test: Numeric Factory Functions for absolute length</title>
        <link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
        <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';
          test(function(){
              var length = CSS.cm(10);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 10);
              assert_equals(length.unit, 'cm');
          }, 'CSS.cm() produces cm length');

          test(function(){
              var length = CSS.mm(20);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 20);
              assert_equals(length.unit, 'mm');
          }, 'CSS.mm() produces mm length');

          test(function(){
              var length = CSS.Q(30);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 30);
              assert_equals(length.unit, 'q');
          }, 'CSS.Q() produces q length');

          test(function(){
              var length = CSS.in(40);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 40);
              assert_equals(length.unit, 'in');
          }, 'CSS.in() produces in length');

          test(function(){
              var length = CSS.pt(50);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 50);
              assert_equals(length.unit, 'pt');
          }, 'CSS.pt() produces pt length');

          test(function(){
              var length = CSS.pc(60);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 60);
              assert_equals(length.unit, 'pc');
          }, 'CSS.pc() produces pc length');

          test(function(){
              var length = CSS.px(70);
              assert_true(length instanceof CSSUnitValue);
              assert_equals(length.value, 70);
              assert_equals(length.unit, 'px');
          }, 'CSS.px() produces px length');
      </script>
    </body>
</html>