aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-10-31 08:58:31 -0400
committerJosh Matthews <josh@joshmatthews.net>2017-10-31 09:04:54 -0400
commit64e0a52537e076c091e8b0713149f827600e1bb0 (patch)
tree1e1e86dd37a33af66e9fbc1d923f1c02d6960175 /tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js
parent43a4f016471d1e1d6b4072f9dd8cf3b8f9dfe48c (diff)
downloadservo-64e0a52537e076c091e8b0713149f827600e1bb0.tar.gz
servo-64e0a52537e076c091e8b0713149f827600e1bb0.zip
Update web-platform-tests to revision 58b72393db0bd273bb93268c33666cf893feb985
Diffstat (limited to 'tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js')
-rw-r--r--tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js b/tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js
new file mode 100644
index 00000000000..7aee234eb43
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-animations/animationevent-interface.js
@@ -0,0 +1,87 @@
+(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", {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");
+})();