tor-browser

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

SVGAnimationElement-getStartTime.html (1870B)


      1 <!DOCTYPE html>
      2 <title>SVGAnimationElement.getStartTime() returns the start time of the current interval.</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <svg height="0">
      6  <animate attributeName="visibility" begin="1s; 3s" dur="1s"/>
      7  <animate attributeName="visibility" begin="1s; 3s" dur="1s" fill="freeze"/>
      8 </svg>
      9 <script>
     10 setup(function() {
     11  window.animationElements = document.querySelectorAll('animate');
     12  window.timeContainer = document.querySelector('svg');
     13 });
     14 
     15 function checkStartTime(values, t) {
     16  assert_equals(animationElements[0].getStartTime(), values[0],
     17                'start time @ ' + t);
     18  assert_equals(animationElements[1].getStartTime(), values[1],
     19                'start time @ ' + t);
     20 }
     21 
     22 function checkHasNoCurrentInterval(t) {
     23  assert_throws_dom('InvalidStateError', () => {
     24    animationElements[0].getStartTime()
     25  }, 'no interval @ ' + t);
     26  assert_throws_dom('InvalidStateError', () => {
     27    animationElements[1].getStartTime()
     28  }, 'no interval @ ' + t);
     29 }
     30 
     31 async_test(t => {
     32  timeContainer.pauseAnimations();
     33  // Wait for the timeline to start.
     34  onload = t.step_func(() => {
     35    t.step_timeout(function() {
     36      assert_equals(timeContainer.getCurrentTime(), 0);
     37      checkStartTime([1, 1], 0);
     38      timeContainer.setCurrentTime(1);
     39      checkStartTime([1, 1], 1);
     40      timeContainer.setCurrentTime(1.5);
     41      checkStartTime([1, 1], 1.5);
     42      timeContainer.setCurrentTime(2);
     43      checkStartTime([3, 3], 2);
     44      timeContainer.setCurrentTime(2.5);
     45      checkStartTime([3, 3], 2.5);
     46      timeContainer.setCurrentTime(3);
     47      checkStartTime([3, 3], 3);
     48      timeContainer.setCurrentTime(4);
     49      checkHasNoCurrentInterval(4);
     50      timeContainer.setCurrentTime(5);
     51      checkHasNoCurrentInterval(5);
     52      t.done();
     53    }, 0);
     54  });
     55 });
     56 </script>