File: transitions-animatable-properties-01.html

package info (click to toggle)
thunderbird 1%3A68.10.0-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,754,812 kB
  • sloc: cpp: 5,411,679; javascript: 4,161,772; ansic: 2,639,702; python: 763,064; java: 346,606; xml: 266,623; asm: 265,884; sh: 117,270; lisp: 41,340; makefile: 23,560; perl: 18,042; objc: 5,277; yacc: 1,778; ada: 1,681; pascal: 1,673; lex: 1,417; cs: 879; exp: 527; awk: 495; php: 436; ruby: 221; sed: 69; csh: 27
file content (179 lines) | stat: -rw-r--r-- 10,035 bytes parent folder | download | duplicates (2)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<!-- Submitted from TestTWF Paris -->
  <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    <title> CSS Transitions: Animatable CSS properties </title>
    <meta name="assert" content="Check that all animatable CSS properties are animatable and then accepted by the 'transition-property' property">
    <meta name="timeout" content="long">
    <link rel="author" title="Daniel Glazman" href="mailto:daniel.glazman@disruptive-innovations.com">
    <link rel="help" href="http://www.w3.org/TR/css3-transitions/#transitions">
    <link rel="help" href="http://www.w3.org/TR/css3-transitions/#animatable-properties">
    <link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com">

    <style type="text/css">

      html, body { margin: 0px; padding: 0px; }

      .w50vw { width: 50vw; )
      .h50vh { height: 50vh; }

      .w50vm { width: 50vm; }
      .h50vm { height: 50vm; }
    </style>

    <script src="/resources/testharness.js" type="text/javascript"></script>
    <script src="/resources/testharnessreport.js" type="text/javascript"></script>

    <style type="text/css" id="newStyles"></style>
  </head>
  <body>
    <p>Check that all animatable CSS properties are animatable and
      then accepted by the 'transition-property' property.<br>
    </p>

    <p id="testP">THIS PROSE NEEDED FOR TEST ITSELF</p>

    <div id="log"></div><a href="transitions-animatable-properties-01.html" id="" title="transitions-animatable-properties-01">transitions-animatable-properties-01</a>

    <script type="text/javascript">
      var kANIMATABLE_CSS_PROPERTIES = [
          ["background-color",    "white",                      "rgb(0, 128, 0)",               "", false],
          ["background-position", "0px 0px",                    "100% 100%",                    "", false],
          ["border-color",        "white",                      "rgb(0, 128, 0)",               "", false],
          ["border-bottom-color", "white",                      "rgb(0, 128, 0)",               "", false],
          ["border-bottom-width", "0px",                        "10px",                         "border-style: solid; border-color: black", false],
          ["border-left-color",   "white",                      "rgb(0, 128, 0)",               "", false],
          ["border-left-width",   "0px",                        "10px",                         "border-style: solid; border-color: black", false],
          ["border-right-color",  "white",                      "rgb(0, 128, 0)",               "", false],
          ["border-right-width",  "0px",                        "10px",                         "border-style: solid; border-color: black", false],
          ["border-spacing",      "0px",                        "10px 15px",                    "", false],
          ["border-top-color",    "white",                      "rgb(0, 128, 0)",               "", false],
          ["border-top-width",    "0px",                        "10px",                         "border-style: solid; border-color: black", false],
          ["bottom",              "0px",                        "10px",                         "", false],
          ["clip",                "rect(0px, 0px, 10px, 10px)", "rect(10px, 10px, 20px, 20px)", "", false],
          ["color",               "white",                      "rgb(0, 128, 0)",               "", false],
          ["crop",                "rect(0px, 0px, 10px, 10px)", "rect(10px 10px 20px 20px)",    "", false],
          ["font-size",           "12pt",                       "32px",                         "", false],
          ["font-weight",         "400",                        "900",                          "", false],
          ["height",              "1em",                        "64px",                         "", false],
          ["left",                "0px",                        "10px",                         "", false],
          ["letter-spacing",      "1em",                        "64px",                         "", false],
          ["line-height",         "1em",                        "64px",                         "", false],
          ["margin-bottom",       "0px",                        "10px",                         "", false],
          ["margin-left",         "0px",                        "10px",                         "", false],
          ["margin-right",        "0px",                        "10px",                         "", false],
          ["margin-top",          "0px",                        "10px",                         "", false],
          ["max-height",          "0px",                        "10px",                         "", false],
          ["max-width",           "0px",                        "10px",                         "", false],
          ["min-height",          "0px",                        "10px",                         "", false],
          ["min-width",           "0px",                        "10px",                         "", false],
          ["opacity",             "0",                          "1",                            "", false],
          ["outline-color",       "white",                      "rgb(0, 128, 0)",               "", false],
          ["outline-offset",      "0px",                        "10px",                         "", false],
          ["outline-width",       "0px",                        "10px",                         "outline-style: solid; outline-style: black", false],
          ["padding-bottom",      "0px",                        "10px",                         "", false],
          ["padding-left",        "0px",                        "10px",                         "", false],
          ["padding-right",       "0px",                        "10px",                         "", false],
          ["padding-top",         "0px",                        "10px",                         "", false],
          ["right",               "0px",                        "10px",                         "", false],
          ["text-indent",         "0px",                        "10px",                         "", false],
          ["text-shadow",         "orange 0 -2px",              "rgb(0, 128, 0) 0px 2px 0px",   "", false],
          ["top",                 "0px",                        "10px",                         "", false],
          ["vertical-align",      "0px",                        "10px",                         "", false],
          ["visibility",          "visible",                    "hidden",                       "", true],
          ["width",               "0px",                        "10px",                         "", false],
          ["word-spacing",        "0px",                        "10px",                         "", false],
          ["z-index",             "1",                           "10",                          "", false]
      ];

      // page timeout
      var kTIMEOUT = 3000000;

      var p = document.getElementById("testP");
      var style = document.getElementById("newStyles");

      var testsIntermediate = [];
      var testsEnd = [];

      setup({timeout: kTIMEOUT});

      // create all the tests we need
      for (var i = 0; i < kANIMATABLE_CSS_PROPERTIES.length; i++) {
        testsIntermediate.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " intermediate"));
        testsEnd.push(async_test(kANIMATABLE_CSS_PROPERTIES[i][0] + " end"));
      }

      // getComputedStyle helper
      function gCS(aProperty)
      {
        return document.defaultView
               .getComputedStyle(p, "")
               .getPropertyValue(aProperty);
      }

      function Scheduler(aIndex)
      {
        if (aIndex >= kANIMATABLE_CSS_PROPERTIES.length) // we're done here
          return;

        var property   = kANIMATABLE_CSS_PROPERTIES[aIndex][0];
        var startValue = kANIMATABLE_CSS_PROPERTIES[aIndex][1];
        var endValue   = kANIMATABLE_CSS_PROPERTIES[aIndex][2];
        var extras     = kANIMATABLE_CSS_PROPERTIES[aIndex][3];
        var discrete   = kANIMATABLE_CSS_PROPERTIES[aIndex][4];

        // create a style rule
        var s = "#testP { ";
        s += property + ": " + startValue + ";\n";
        s += "transition-property: " + property + ";\n";
        s += "transition-duration: 0.5s;\n";
        s += "transition-delay: 0s;\n";
        s += "transition-timing-function: linear;\n";
        s += extras;
        s += "}";
        style.textContent = s;

        // flush styles
        gCS(property);

        // set property to endValue
        p.setAttribute("style", property + ": " + endValue + "; ");

        // test for intermediate value
        setTimeout(function()
                   {
                     testsIntermediate[aIndex].step(function()
                                         {
                                           var cs = gCS(property);
                                           if (discrete) {
                                             assert_equals(cs, startValue);
                                           }
                                           else {
                                             assert_true((cs != startValue) && (null != cs));
                                           }
                                         });
                     testsIntermediate[aIndex].done();
                   }, 250);

        // test for final value
        setTimeout(function()
                   {
                     testsEnd[aIndex].step(function()
                                           {
                                             var cs = gCS(property);
                                             assert_equals(cs, endValue);
                                           }
                                          );
                     testsEnd[aIndex].done();
                     Scheduler(aIndex + 1);
                   }, 600);

      }

      // let's start
      Scheduler(0);

    </script>
  </body>
</html>