fune/testing/web-platform/tests/css/css-animations/animationevent-interface.js
Xida Chen fd9a5813bf Bug 1455303 [wpt PR 10532] - Implement AnimationEvent.pseudoElement, a=testonly
Automatic update from web-platform-testsImplement AnimationEvent.pseudoElement

The spec is here:
https://drafts.csswg.org/css-animations/#interface-animationevent

A layout test is changed to test this API.

Bug: 437132
Change-Id: Ic463b19488271e1caeb78afa6120bb53f7d5e94d
Reviewed-on: https://chromium-review.googlesource.com/1019383
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555898}

--

wpt-commits: 1550fc2313eca53eec8ea88a2b024446665ea4bf
wpt-pr: 10532
2018-05-14 09:54:55 +00:00

92 lines
3 KiB
JavaScript

(function() {
test(function() {
var event = new AnimationEvent("");
assert_true(event instanceof window.AnimationEvent);
}, "the event is an instance of AnimationEvent");
test(function() {
var event = new AnimationEvent("");
assert_true(event instanceof window.Event);
}, "the event inherts from Event");
test(function() {
assert_throws(new TypeError(), function() {
new AnimationEvent();
}, 'First argument is required, so was expecting a TypeError.');
}, 'Missing type argument');
test(function() {
var event = new AnimationEvent("test");
assert_equals(event.type, "test");
}, "type argument is string");
test(function() {
var event = new AnimationEvent(null);
assert_equals(event.type, "null");
}, "type argument is null");
test(function() {
var event = new AnimationEvent(undefined);
assert_equals(event.type, "undefined");
}, "event type set to undefined");
test(function() {
var event = new AnimationEvent("test");
assert_equals(event.animationName, "");
}, "animationName has default value of empty string");
test(function() {
var event = new AnimationEvent("test");
assert_equals(event.elapsedTime, 0.0);
}, "elapsedTime has default value of 0.0");
test(function() {
var event = new AnimationEvent("test");
assert_readonly(event, "animationName", "readonly attribute value");
}, "animationName is readonly");
test(function() {
var event = new AnimationEvent("test");
assert_readonly(event, "elapsedTime", "readonly attribute value");
}, "elapsedTime is readonly");
test(function() {
var event = new AnimationEvent("test", null);
assert_equals(event.animationName, "");
assert_equals(event.elapsedTime, 0.0);
}, "animationEventInit argument is null");
test(function() {
var event = new AnimationEvent("test", undefined);
assert_equals(event.animationName, "");
assert_equals(event.elapsedTime, 0.0);
}, "animationEventInit argument is undefined");
test(function() {
var event = new AnimationEvent("test", {});
assert_equals(event.animationName, "");
assert_equals(event.elapsedTime, 0.0);
}, "animationEventInit argument is empty dictionary");
test(function() {
var event = new AnimationEvent("test", {pseudoElement: "::testPseudo"});
assert_equals(event.pseudoElement, "::testPseudo");
}, "AnimationEvent.pseudoElement initialized from the dictionary");
test(function() {
var event = new AnimationEvent("test", {animationName: "sample"});
assert_equals(event.animationName, "sample");
}, "animationName set to 'sample'");
test(function() {
var event = new AnimationEvent("test", {elapsedTime: 0.5});
assert_equals(event.elapsedTime, 0.5);
}, "elapsedTime set to 0.5");
test(function() {
var eventInit = {animationName: "sample", elapsedTime: 0.5};
var event = new AnimationEvent("test", eventInit);
assert_equals(event.animationName, "sample");
assert_equals(event.elapsedTime, 0.5);
}, "AnimationEventInit properties set value");
})();