Bug 1045993 part 4 - Add tests for Animation.effect.name; r=dbaron
authorBrian Birtles <birtles@gmail.com>
Fri, 22 Aug 2014 13:42:48 +0100
changeset 222774 2312266dfc01c1b150b1b6eb102c57fe301d7a66
parent 222773 81bfd63430a41d003edac128ce94acf36cf9af86
child 222775 8ae173319e56dccc84849ce407b586cda69a9fe9
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1045993
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1045993 part 4 - Add tests for Animation.effect.name; r=dbaron
dom/animation/test/css-integration/test_animation-effect-name.html
dom/animation/test/mochitest.ini
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/css-integration/test_animation-effect-name.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<style>
+@keyframes xyz {
+  to { left: 100px }
+}
+</style>
+<script>
+'use strict';
+
+function addDiv() {
+  var div = document.createElement('div');
+  document.body.appendChild(div);
+  return div;
+}
+
+test(function() {
+  var div = addDiv();
+  div.style.animation = 'xyz 100s';
+  window.getComputedStyle(div).animationName;
+
+  assert_equals(div.getAnimationPlayers()[0].source.effect.name, 'xyz',
+                'Animation effect name matches keyframes rule name');
+  div.remove();
+}, 'Effect name makes keyframe rule');
+
+test(function() {
+  var div = addDiv();
+  div.style.animation = 'x\\yz 100s';
+  dump(window.getComputedStyle(div).animationName + "\n");
+
+  assert_equals(div.getAnimationPlayers()[0].source.effect.name, 'xyz',
+                'Escaped animation effect name matches keyframes rule name');
+  div.remove();
+}, 'Escaped animation name');
+
+test(function() {
+  var div = addDiv();
+  div.style.animation = 'x\\79 z 100s';
+  window.getComputedStyle(div).animationName;
+
+  assert_equals(div.getAnimationPlayers()[0].source.effect.name, 'xyz',
+                'Hex-escaped animation effect name matches keyframes rule'
+                + ' name');
+  div.remove();
+}, 'Animation name with hex-escape');
+
+test(function() {
+  var div = addDiv();
+
+  // Add a transition
+  div.style.left = '0px';
+  window.getComputedStyle(div).transitionProperty;
+  div.style.transition = 'all 100s';
+  div.style.left = '100px';
+  window.getComputedStyle(div).left;
+
+  assert_equals(div.getAnimationPlayers()[0].source.effect.name, '',
+                'Animation effects for transitions have an empty name');
+  div.remove();
+}, 'Effect name for transitions');
+</script>
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -1,5 +1,6 @@
 [animation-timeline/test_animation-timeline.html]
 skip-if = buildapp == 'mulet'
 [css-integration/test_element-get-animation-players.html]
 skip-if = buildapp == 'mulet'
 [css-integration/test_animations-dynamic-changes.html]
+[css-integration/test_animation-effect-name.html]