Bug 1265611 - Add tests for CSS animations draft
authorBrian Birtles <birtles@gmail.com>
Thu, 21 Apr 2016 08:57:43 +0900
changeset 354494 036d56f4da74b77a1af1c65f2a1688f631939c12
parent 354493 87932afdb6b34ed8a262d463e884dc810bc35296
child 354495 149106214df5f4c7feb211ea1ea251af559ccd7b
push id16093
push userbbirtles@mozilla.com
push dateThu, 21 Apr 2016 00:32:40 +0000
bugs1265611
milestone48.0a1
Bug 1265611 - Add tests for CSS animations MozReview-Commit-ID: LTnRxQixqzJ
layout/style/test/file_animations_with_disabled_properties.html
layout/style/test/mochitest.ini
layout/style/test/test_animations_with_disabled_properties.html
new file mode 100644
--- /dev/null
+++ b/layout/style/test/file_animations_with_disabled_properties.html
@@ -0,0 +1,57 @@
+<!doctype html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1265611
+-->
+<head>
+  <meta charset=utf-8>
+  <title>Test for bug 1265611</title>
+  <style>
+  @keyframes enabled-and-disabled {
+    from {
+      left: 0px;
+      -webkit-text-fill-color: green;
+    }
+    to {
+      left: 100px;
+      -webkit-text-fill-color: blue;
+    }
+  }
+  </style>
+  <script>
+    var is = opener.is.bind(opener);
+    var ok = opener.ok.bind(opener);
+    var todo = opener.todo.bind(opener);
+    function finish() {
+      var o = opener;
+      self.close();
+      o.SimpleTest.finish();
+    }
+  </script>
+</head>
+<body>
+<div id="display"></div>
+<script type="application/javascript">
+'use strict';
+
+var display = document.getElementById('display');
+display.style.animation = 'enabled-and-disabled 0.01s';
+
+var animation = display.getAnimations()[0];
+is(animation.effect.getFrames().length, 2,
+   'Got two frames on the generated animation');
+
+ok(animation.effect.getFrames()[0].hasOwnProperty('left'),
+   'Enabled property is set on initial keyframe');
+ok(!animation.effect.getFrames()[0].hasOwnProperty('webkitTextFillColor'),
+   'Disabled property is not set on initial keyframe');
+
+ok(animation.effect.getFrames()[1].hasOwnProperty('left'),
+   'Enabled property is set on final keyframe');
+ok(!animation.effect.getFrames()[1].hasOwnProperty('webkitTextFillColor'),
+   'Disabled property is not set on final keyframe');
+
+finish();
+</script>
+</body>
+</html>
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -58,16 +58,18 @@ support-files = file_animations_iteratio
 [test_animations_omta_start.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # bug 1041017
 [test_animations_pausing.html]
 support-files = file_animations_pausing.html
 [test_animations_playbackrate.html]
 support-files = file_animations_playbackrate.html
 [test_animations_styles_on_event.html]
 support-files = file_animations_styles_on_event.html
+[test_animations_with_disabled_properties.html]
+support-files = file_animations_with_disabled_properties.html
 [test_any_dynamic.html]
 [test_at_rule_parse_serialize.html]
 [test_attribute_selector_eof_behavior.html]
 [test_background_blend_mode.html]
 [test_box_size_keywords.html]
 [test_bug73586.html]
 [test_bug74880.html]
 [test_bug98997.html]
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_animations_with_disabled_properties.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1265611
+-->
+<head>
+  <title>Test CSS animations ignore disabled properties (Bug 1265611)</title>
+  <script type="application/javascript"
+    src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank"
+   href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265611">Mozilla Bug
+   1265611</a>
+<div id="display"></div>
+<pre id="test">
+<script>
+'use strict';
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv(
+  { 'set': [[ 'dom.animations-api.core.enabled', true ],
+            [ 'layout.css.prefixes.webkit', false ]] },
+  function() {
+    window.open('file_animations_with_disabled_properties.html');
+  });
+</script>
+</pre>
+</body>
+</html>