tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

properties-value-001.html (6555B)


      1 <!DOCTYPE html>
      2 <html>
      3    <head>
      4        <meta charset="utf-8">
      5        <title>CSS Transitions Test: Intermediate Property Values</title>
      6        <meta name="timeout" content="long">
      7        <meta name="assert" content="Test checks that value ranges between start and end while transitioning">
      8        <link rel="help" href="http://www.w3.org/TR/css3-transitions/#transitions">
      9        <link rel="help" href="https://drafts.csswg.org/web-animations-1/#animation-type">
     10        <link rel="author" title="Rodney Rehm" href="http://rodneyrehm.de/en/">
     11        <meta name="flags" content="dom">
     12 
     13        <script src="/resources/testharness.js" type="text/javascript"></script>
     14        <script src="/resources/testharnessreport.js" type="text/javascript"></script>
     15 
     16        <script src="./support/vendorPrefix.js" type="text/javascript"></script>
     17        <script src="./support/helper.js" type="text/javascript"></script>
     18        <script src="./support/runParallelAsyncHarness.js" type="text/javascript"></script>
     19        <script src="./support/generalParallelTest.js" type="text/javascript"></script>
     20        <script src="./support/properties.js" type="text/javascript"></script>
     21 
     22        <style type="text/css">
     23            #offscreen {
     24                position: absolute;
     25                top: -100000px;
     26                left: -100000px;
     27                width: 100000px;
     28                height: 100000px;
     29            }
     30        </style>
     31    </head>
     32    <body>
     33        <!-- required by testharnessreport.js -->
     34        <div id="log"></div>
     35        <!-- elements used for testing -->
     36        <div id="fixture" class="fixture">
     37            <div class="container">
     38                <div class="transition">Text sample</div>
     39            </div>
     40        </div>
     41        <div id="offscreen"></div>
     42 
     43        <!--
     44            SEE ./support/README.md for an abstract explanation of the test procedure
     45            http://test.csswg.org/source/contributors/rodneyrehm/submitted/css3-transitions/README.md
     46        -->
     47 
     48        <script>
     49            // this test takes its time, give it a minute to run
     50            var timeout = 60000;
     51            setup({timeout: timeout});
     52 
     53            var tests = getPropertyTests();
     54            // for testing, limit to a couple of iterations
     55            // tests = tests.slice(10, 30);
     56            // or filter using one of:
     57            // tests = filterPropertyTests(tests, "background-color color(rgba)");
     58            // tests = filterPropertyTests(tests, ["background-color color(rgba)", ...]);
     59            // tests = filterPropertyTests(tests, /^background-color/);
     60 
     61            // general transition-duration
     62            var duration = '2s';
     63 
     64            runParallelAsyncHarness({
     65                // array of test data
     66                tests: tests,
     67                // the number of tests to run in parallel
     68                testsPerSlice: 50,
     69                // milliseconds to wait before calling teardown and ending test
     70                duration: parseFloat(duration) * 1000,
     71                // prepare individual test
     72                setup: function(data, options) {
     73                    var styles = {
     74                        '.fixture': {},
     75 
     76                        '.container': data.parentStyle,
     77                        '.container.to': {},
     78                        '.container.how': {},
     79 
     80                        '.transition': data.from,
     81                        '.transition.to' : data.to,
     82                        '.transition.how' : {transition: 'all ' + duration + ' linear 0s'}
     83                    };
     84 
     85                    generalParallelTest.setup(data, options);
     86                    generalParallelTest.addStyles(data, options, styles);
     87                },
     88                // cleanup after individual test
     89                teardown: generalParallelTest.teardown,
     90                // invoked prior to running a slice of tests
     91                sliceStart: generalParallelTest.sliceStart,
     92                // invoked after transitions have started
     93                transitionsStarted: generalParallelTest.transitionsStarted,
     94                // invoked after running a slice of tests
     95                sliceDone: generalParallelTest.sliceDone,
     96                // test cases, make them as granular as possible
     97                cases: {
     98                    // test property values while transitioning
     99                    // values.start kicks off a transition
    100                    'values': {
    101                        // run actual test, assertions can be used here!
    102                        start: function(test, data, options) {
    103                            // identify initial and target values
    104                            generalParallelTest.getStyle(data);
    105                            // make sure values differ, if they don't, the property could most likely not be parsed
    106                            assert_not_equals(data.transition.from, data.transition.to, "initial and target values may not match");
    107                            // kick off the transition
    108                            generalParallelTest.startTransition(data);
    109 
    110                            // make sure we didn't get the target value immediately.
    111                            // If we did, there wouldn't be a transition!
    112                            var current = data.transition.computedStyle(data.property);
    113                            assert_not_equals(current, data.transition.to, "must not be target value after start");
    114                        },
    115                        done: function(test, data, options) {
    116                            // make sure the property's value were neither initial nor target while transitioning
    117                            test.step(generalParallelTest.assertIntermediateValuesFunc(data, 'transition'));
    118                        }
    119                    },
    120                    // test TransitionEnd events
    121                    'events': {
    122                        done: function(test, data, options) {
    123                            // make sure there were no events on parent
    124                            test.step(generalParallelTest.assertExpectedEventsFunc(data, 'container', ""));
    125                            // make sure we got the event for the tested property only
    126                            test.step(generalParallelTest.assertExpectedEventsFunc(data, 'transition', addVendorPrefix(data.property) + ":" + duration));
    127                        }
    128                    }
    129                },
    130                // called once all tests are done
    131                done: generalParallelTest.done
    132            });
    133        </script>
    134    </body>
    135 </html>