summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/web-animations-api/player-cancel-event.html
blob: 5aa72983565df194aede999c4863bf0cc770d989 (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
<!DOCTYPE html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
var anim1 = document.body.animate([], 100000);
var anim2 = document.body.animate([], 100000);

var cancelTest = async_test('Cancelling animation should create cancel event.');
var fired = false;

anim1.oncancel = function(event) {
  cancelTest.step(function() {
    assert_equals(event.target, anim1, 'Target of cancel event should be anim1.');
    assert_equals(event.currentTime, null, 'currentTime of cancel event should be null.');
    assert_equals(event.timelineTime, document.timeline.currentTime, 'Event timelineTime should be same as document.timeline.currentTime.');
  });
  fired = true;
};

anim2.onfinish = function() {
  cancelTest.step(function() {
    assert_true(fired, 'anim1.oncancel should be called.');
  });
  cancelTest.done();
};

anim1.cancel();
anim2.finish();
</script>
</body>