File: before-load-001.html

package info (click to toggle)
firefox-esr 68.10.0esr-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,143,932 kB
  • sloc: cpp: 5,227,879; javascript: 4,315,531; ansic: 2,467,042; python: 794,975; java: 349,993; asm: 232,034; xml: 228,320; sh: 82,008; lisp: 41,202; makefile: 22,347; perl: 15,555; objc: 5,277; cs: 4,725; yacc: 1,778; ada: 1,681; pascal: 1,673; lex: 1,417; exp: 527; php: 436; ruby: 225; awk: 162; sed: 53; csh: 44
file content (150 lines) | stat: -rw-r--r-- 7,184 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
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>CSS Transitions Test: Transitioning before load event</title>
        <meta name="assert" content="Test checks that transitions are run even before all assets are loaded">
        <link rel="help" title="5. Transition Events" href="http://www.w3.org/TR/css3-transitions/#transition-events">
        <link rel="author" title="Rodney Rehm" href="http://rodneyrehm.de/en/">
        <meta name="flags" content="dom">

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

        <script src="./support/vendorPrefix.js" type="text/javascript"></script>
        <script src="./support/helper.js" type="text/javascript"></script>
        <script src="./support/runParallelAsyncHarness.js" type="text/javascript"></script>
        <script src="./support/generalParallelTest.js" type="text/javascript"></script>
        <script src="./support/properties.js" type="text/javascript"></script>

        <style type="text/css">
            #offscreen {
                position: absolute;
                top: -100000px;
                left: -100000px;
                width: 100000px;
                height: 100000px;
            }
        </style>
    </head>
    <body>
        <!-- required by testharnessreport.js -->
        <div id="log"></div>
        <!-- elements used for testing -->
        <div id="fixture" class="fixture">
            <div class="container">
                <div class="transition">Text sample</div>
            </div>
        </div>
        <div id="offs-creen"></div>

        <!--
            SEE ./support/README.md for an abstract explanation of the test procedure
            http://test.csswg.org/source/contributors/rodneyrehm/submitted/css3-transitions/README.md
        -->

        <script>
            // make sure a transition is run between DOMContentLoaded and load

            // this test takes its time, give it a minute to run
            var timeout = 60000;
            setup({timeout: timeout});

            var isLoad = false;
            window.addEventListener('load', function() {
                isLoad = true;
            }, false);

            window.addEventListener('DOMContentLoaded', function() {
                var tests = [
                    {
                        name: "transition height from 10px to 100px",
                        property: 'height',
                        flags: {},
                        from: {'height': '10px'},
                        to: {'height': '100px'}
                    }
                ];

                // general transition-duration
                var duration = '0.5s';

                runParallelAsyncHarness({
                    // array of test data
                    tests: tests,
                    // the number of tests to run in parallel
                    testsPerSlice: 1,
                    // milliseconds to wait before calling teardown and ending test
                    duration: parseFloat(duration) * 1000,
                    // prepare individual test
                    setup: function(data, options) {
                        var styles = {
                            '.fixture': {},

                            '.container': data.parentStyle,
                            '.container.to': {},
                            '.container.how': {},

                            '.transition': data.from,
                            '.transition.to' : data.to,
                            '.transition.how' : {transition: 'all ' + duration + ' linear 0s'}
                        };

                        generalParallelTest.setup(data, options);
                        generalParallelTest.addStyles(data, options, styles);
                    },
                    // cleanup after individual test
                    teardown: generalParallelTest.teardown,
                    // invoked prior to running a slice of tests
                    sliceStart: function(options, tests) {
                        // inject styles into document
                        setStyle(options.styles);
                    },
                    // invoked after running a slice of tests
                    sliceDone: generalParallelTest.sliceDone,
                    // test cases, make them as granular as possible
                    cases: {
                        // test property values while transitioning
                        // values.start kicks off a transition
                        'values': {
                            // run actual test, assertions can be used here!
                            start: function(test, data, options) {
                                // identify initial and target values
                                generalParallelTest.getStyle(data);
                                // make sure values differ, if they don't, the property could most likely not be parsed
                                assert_not_equals(data.transition.from, data.transition.to, "initial and target values may not match");
                                // kick off the transition
                                generalParallelTest.startTransition(data);

                                // make sure we didn't get the target value immediately.
                                // If we did, there wouldn't be a transition!
                                var current = data.transition.computedStyle(data.property);
                                assert_not_equals(current, data.transition.to, "must not be target value after start");
                            },
                            done: function(test, data, options) {
                                // make sure the property's value were neither initial nor target while transitioning
                                test.step(generalParallelTest.assertIntermediateValuesFunc(data, 'transition'));
                            }
                        },
                        // test TransitionEnd events
                        'events': {
                            done: function(test, data, options) {
                                // make sure there were no events on parent
                                test.step(generalParallelTest.assertExpectedEventsFunc(data, 'container', ""));
                                // make sure we got the event for the tested property only
                                test.step(generalParallelTest.assertExpectedEventsFunc(data, 'transition', addVendorPrefix(data.property) + ":" + duration));

                                test.step(function() {
                                    assert_false(isLoad, "load may not have happened yet")
                                });
                            }
                        }
                    },
                    // called once all tests are done
                    done: generalParallelTest.done
                });
            }, false);
        </script>
        <img src="/delay/?type=gif&amp;delay=3000" alt="dummy image">
    </body>
</html>