tor-browser

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

display-none-to-display-block-dont-cancel.tentative.html (1374B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
      3 <link rel="help" href="https://drafts.csswg.org/css-display-4/#display-animation">
      4 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/6429">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/css/css-animations/support/testcommon.js"></script>
      8 
      9 <div id="target">hello</div>
     10 <style>
     11 @keyframes display-animation {
     12  0% { display: none; }
     13  100% { display: block; }
     14 }
     15 #target {
     16  display: none;
     17 }
     18 #target.animate {
     19  animation: display-animation 1s;
     20  display: block;
     21 }
     22 </style>
     23 <script>
     24 promise_test(async (t) => {
     25  t.add_cleanup(() => target.classList.remove('animate'));
     26  let numAnimationstartFired = 0;
     27  target.addEventListener('animationstart', () => numAnimationstartFired++);
     28 
     29  assert_equals(getComputedStyle(target).display, 'none',
     30  'The display should be none before the animation.');
     31 
     32  await waitForAnimationFrames(1);
     33  target.classList.add('animate');
     34  await waitForAnimationFrames(2);
     35 
     36  assert_equals(getComputedStyle(target).display, 'block',
     37    'The display should be block during the animation.');
     38  assert_equals(numAnimationstartFired, 1,
     39    'Only one animation should start.');
     40 }, 'display:none animating to display:block should be block for the whole animation.');
     41 </script>