summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/animations/animation-events-unprefixed-04.html
blob: 9f858604b6060ac67c9f554f328fa3f8da1c1d52 (plain)
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
<!DOCTYPE html>
<html>
<head>
  <title>Tests that custom events with unprefixed animations names are correctly dispatched.</title>
  <script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    document.addEventListener('animationstart', function(e) {
      document.getElementById('result').innerHTML += 'PASS: animationstart event listener has been called.<br>';
    }, false);

    document.addEventListener('webkitAnimationStart', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: webkitAnimationStart event listener should not have been called.<br>';
    }, false);

    document.addEventListener('animationiteration', function(e) {
      document.getElementById('result').innerHTML += 'PASS: animationiteration event listener has been called.<br>';
    }, false);

    document.addEventListener('webkitAnimationIteration', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: webkitAnimationIteration event listener should not have been called.<br>';
    }, false);

    document.addEventListener('animationend', function(e) {
      document.getElementById('result').innerHTML += 'PASS: animationend event listener has been called.';
      if (window.testRunner)
        testRunner.notifyDone();
    }, false);

    document.addEventListener('webkitAnimationEnd', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: webkitAnimationEnd event listener should not have been called.';
      if (window.testRunner)
        testRunner.notifyDone();
    }, false);

  </script>
</head>
<body>
Tests that custom events with unprefixed animations names are correctly dispatched.
<pre id="result"></pre>
</body>
<script>
  var custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('animationstart', true, true, null);
  document.dispatchEvent(custom);
  custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('animationiteration', true, true, null);
  document.dispatchEvent(custom);
  custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('animationend', true, true, null);
  document.dispatchEvent(custom);
</script>
</html>