tor-browser

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

properties-value-002.html (6688B)


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