Bug 1033881 part 2 - Add tests to test_element-get-animation-players.html which checks for animation-name: missing; r=dbaron
authorBrian Birtles <birtles@gmail.com>
Thu, 17 Jul 2014 10:04:56 +0900
changeset 216452 40a3b13a460b12e84853ebd5d6752486edc250db
parent 216451 8418588984742f485dfb382f146d6d82ee28aebf
child 216453 eb7dda331d9941916537b4a0949eda94c35f5f5b
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1033881
milestone33.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 1033881 part 2 - Add tests to test_element-get-animation-players.html which checks for animation-name: missing; r=dbaron
dom/animation/test/css-integration/test_element-get-animation-players.html
--- a/dom/animation/test/css-integration/test_element-get-animation-players.html
+++ b/dom/animation/test/css-integration/test_element-get-animation-players.html
@@ -191,16 +191,64 @@ test(function() {
     'getAnimationPlayers returns players only for those CSS Animations whose'
     + ' animation-name is not none');
 
   div.remove();
 }, 'getAnimationPlayers for CSS Animations with animation-name: none');
 
 test(function() {
   var div = addDiv();
+  div.style.animation = 'missing 100s';
+  window.getComputedStyle(div).animationName;
+
+  var players = div.getAnimationPlayers();
+  assert_equals(players.length, 0,
+    'getAnimationPlayers returns an empty sequence for an element'
+    + ' with animation-name: missing');
+
+  div.style.animation = 'anim1 100s, missing 100s';
+  window.getComputedStyle(div).animationName;
+  players = div.getAnimationPlayers();
+  assert_equals(players.length, 1,
+    'getAnimationPlayers returns players only for those CSS Animations whose'
+    + ' animation-name is found');
+
+  div.remove();
+}, 'getAnimationPlayers for CSS Animations with animation-name: missing');
+
+async_test(function(t) {
+  var div = addDiv();
+  div.style.animation = 'anim1 100s, notyet 100s';
+  window.getComputedStyle(div).animationName;
+
+  var players = div.getAnimationPlayers();
+  assert_equals(players.length, 1,
+    'getAnimationPlayers initally only returns players for CSS Animations whose'
+    + ' animation-name is found');
+
+  window.requestAnimationFrame(t.step_func(function() {
+    var keyframes = '@keyframes notyet { to { left: 100px; } }';
+    document.styleSheets[0].insertRule(keyframes, 0);
+    window.getComputedStyle(div).animationName;
+
+    players = div.getAnimationPlayers();
+    assert_equals(players.length, 2,
+      'getAnimationPlayers includes player when @keyframes rule is added'
+      + ' later');
+    assert_true(players[0].startTime < players[1].startTime,
+      'Newly added player has a later start time');
+    document.styleSheets[0].deleteRule(0);
+    div.remove();
+    t.done();
+  }));
+}, 'getAnimationPlayers for CSS Animations where the @keyframes rule is added'
+   + ' later');
+
+test(function() {
+  var div = addDiv();
   div.style.animation = 'anim1 100s, anim1 100s';
   window.getComputedStyle(div).animationName;
 
   assert_equals(div.getAnimationPlayers().length, 2,
     'getAnimationPlayers returns one player for each CSS animation-name'
     + ' even if the names are duplicated');
   div.remove();
 }, 'getAnimationPlayers for CSS Animations with duplicated animation-name');