forked from mirrors/gecko-dev
		
	See the description in this changeset's parent which describes why we do this in two steps. MozReview-Commit-ID: GtO0SCb0UOF --HG-- rename : dom/animation/test/css-animations/test_animation-cancel_to_rename.html => dom/animation/test/css-animations/test_animation-cancel.html rename : dom/animation/test/css-animations/test_animation-computed-timing_to_rename.html => dom/animation/test/css-animations/test_animation-computed-timing.html rename : dom/animation/test/css-animations/test_animation-currenttime_to_rename.html => dom/animation/test/css-animations/test_animation-currenttime.html rename : dom/animation/test/css-animations/test_animation-finish_to_rename.html => dom/animation/test/css-animations/test_animation-finish.html rename : dom/animation/test/css-animations/test_animation-finished_to_rename.html => dom/animation/test/css-animations/test_animation-finished.html rename : dom/animation/test/css-animations/test_animation-id_to_rename.html => dom/animation/test/css-animations/test_animation-id.html rename : dom/animation/test/css-animations/test_animation-pausing_to_rename.html => dom/animation/test/css-animations/test_animation-pausing.html rename : dom/animation/test/css-animations/test_animation-playstate_to_rename.html => dom/animation/test/css-animations/test_animation-playstate.html rename : dom/animation/test/css-animations/test_animation-ready_to_rename.html => dom/animation/test/css-animations/test_animation-ready.html rename : dom/animation/test/css-animations/test_animation-reverse_to_rename.html => dom/animation/test/css-animations/test_animation-reverse.html rename : dom/animation/test/css-animations/test_animation-starttime_to_rename.html => dom/animation/test/css-animations/test_animation-starttime.html rename : dom/animation/test/css-animations/test_animations-dynamic-changes_to_rename.html => dom/animation/test/css-animations/test_animations-dynamic-changes.html rename : dom/animation/test/css-animations/test_cssanimation-animationname_to_rename.html => dom/animation/test/css-animations/test_cssanimation-animationname.html rename : dom/animation/test/css-animations/test_document-get-animations_to_rename.html => dom/animation/test/css-animations/test_document-get-animations.html rename : dom/animation/test/css-animations/test_effect-target_to_rename.html => dom/animation/test/css-animations/test_effect-target.html rename : dom/animation/test/css-animations/test_element-get-animations_to_rename.html => dom/animation/test/css-animations/test_element-get-animations.html rename : dom/animation/test/css-animations/test_event-dispatch_to_rename.html => dom/animation/test/css-animations/test_event-dispatch.html rename : dom/animation/test/css-animations/test_event-order_to_rename.html => dom/animation/test/css-animations/test_event-order.html rename : dom/animation/test/css-animations/test_keyframeeffect-getkeyframes_to_rename.html => dom/animation/test/css-animations/test_keyframeeffect-getkeyframes.html rename : dom/animation/test/css-animations/test_pseudoElement-get-animations_to_rename.html => dom/animation/test/css-animations/test_pseudoElement-get-animations.html rename : dom/animation/test/css-animations/test_setting-effect_to_rename.html => dom/animation/test/css-animations/test_setting-effect.html rename : dom/animation/test/css-transitions/test_animation-cancel_to_rename.html => dom/animation/test/css-transitions/test_animation-cancel.html rename : dom/animation/test/css-transitions/test_animation-computed-timing_to_rename.html => dom/animation/test/css-transitions/test_animation-computed-timing.html rename : dom/animation/test/css-transitions/test_animation-currenttime_to_rename.html => dom/animation/test/css-transitions/test_animation-currenttime.html rename : dom/animation/test/css-transitions/test_animation-finished_to_rename.html => dom/animation/test/css-transitions/test_animation-finished.html rename : dom/animation/test/css-transitions/test_animation-pausing_to_rename.html => dom/animation/test/css-transitions/test_animation-pausing.html rename : dom/animation/test/css-transitions/test_animation-ready_to_rename.html => dom/animation/test/css-transitions/test_animation-ready.html rename : dom/animation/test/css-transitions/test_animation-starttime_to_rename.html => dom/animation/test/css-transitions/test_animation-starttime.html rename : dom/animation/test/css-transitions/test_csstransition-transitionproperty_to_rename.html => dom/animation/test/css-transitions/test_csstransition-transitionproperty.html rename : dom/animation/test/css-transitions/test_document-get-animations_to_rename.html => dom/animation/test/css-transitions/test_document-get-animations.html rename : dom/animation/test/css-transitions/test_effect-target_to_rename.html => dom/animation/test/css-transitions/test_effect-target.html rename : dom/animation/test/css-transitions/test_element-get-animations_to_rename.html => dom/animation/test/css-transitions/test_element-get-animations.html rename : dom/animation/test/css-transitions/test_event-dispatch_to_rename.html => dom/animation/test/css-transitions/test_event-dispatch.html rename : dom/animation/test/css-transitions/test_keyframeeffect-getkeyframes_to_rename.html => dom/animation/test/css-transitions/test_keyframeeffect-getkeyframes.html rename : dom/animation/test/css-transitions/test_pseudoElement-get-animations_to_rename.html => dom/animation/test/css-transitions/test_pseudoElement-get-animations.html rename : dom/animation/test/css-transitions/test_setting-effect_to_rename.html => dom/animation/test/css-transitions/test_setting-effect.html rename : dom/animation/test/document-timeline/test_document-timeline_to_rename.html => dom/animation/test/document-timeline/test_document-timeline.html rename : dom/animation/test/mozilla/test_cubic_bezier_limits_to_rename.html => dom/animation/test/mozilla/test_cubic_bezier_limits.html rename : dom/animation/test/mozilla/test_disabled_properties_to_rename.html => dom/animation/test/mozilla/test_disabled_properties.html rename : dom/animation/test/mozilla/test_hide_and_show_to_rename.html => dom/animation/test/mozilla/test_hide_and_show.html rename : dom/animation/test/mozilla/test_restyling_xhr_doc_to_rename.html => dom/animation/test/mozilla/test_restyling_xhr_doc.html rename : dom/animation/test/mozilla/test_transform_limits_to_rename.html => dom/animation/test/mozilla/test_transform_limits.html rename : dom/animation/test/style/test_animation-seeking-with-current-time_to_rename.html => dom/animation/test/style/test_animation-seeking-with-current-time.html rename : dom/animation/test/style/test_animation-seeking-with-start-time_to_rename.html => dom/animation/test/style/test_animation-seeking-with-start-time.html rename : dom/animation/test/style/test_animation-setting-effect_to_rename.html => dom/animation/test/style/test_animation-setting-effect.html rename : dom/animation/test/style/test_composite_to_rename.html => dom/animation/test/style/test_composite.html rename : dom/animation/test/style/test_missing-keyframe-on-compositor_to_rename.html => dom/animation/test/style/test_missing-keyframe-on-compositor.html rename : dom/animation/test/style/test_missing-keyframe_to_rename.html => dom/animation/test/style/test_missing-keyframe.html
		
			
				
	
	
		
			95 lines
		
	
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!doctype html>
 | 
						|
<meta charset=utf-8>
 | 
						|
<script src="/resources/testharness.js"></script>
 | 
						|
<script src="/resources/testharnessreport.js"></script>
 | 
						|
<script src="../testcommon.js"></script>
 | 
						|
<body>
 | 
						|
<div id="log"></div>
 | 
						|
<script>
 | 
						|
'use strict';
 | 
						|
 | 
						|
test(function(t) {
 | 
						|
  assert_equals(document.getAnimations().length, 0,
 | 
						|
    'getAnimations returns an empty sequence for a document'
 | 
						|
    + ' with no animations');
 | 
						|
}, 'getAnimations for non-animated content');
 | 
						|
 | 
						|
test(function(t) {
 | 
						|
  var div = addDiv(t);
 | 
						|
 | 
						|
  // Add a couple of transitions
 | 
						|
  div.style.left = '0px';
 | 
						|
  div.style.top = '0px';
 | 
						|
  getComputedStyle(div).transitionProperty;
 | 
						|
 | 
						|
  div.style.transition = 'all 100s';
 | 
						|
  div.style.left = '100px';
 | 
						|
  div.style.top = '100px';
 | 
						|
  assert_equals(document.getAnimations().length, 2,
 | 
						|
                'getAnimations returns two running CSS Transitions');
 | 
						|
 | 
						|
  // Remove both
 | 
						|
  div.style.transitionProperty = 'none';
 | 
						|
  assert_equals(document.getAnimations().length, 0,
 | 
						|
                'getAnimations returns no running CSS Transitions');
 | 
						|
}, 'getAnimations for CSS Transitions');
 | 
						|
 | 
						|
test(function(t) {
 | 
						|
  addStyle(t, { '.init::after': 'content: ""; width: 0px; ' +
 | 
						|
                                'transition: all 100s;',
 | 
						|
                '.init::before': 'content: ""; width: 0px; ' +
 | 
						|
                                 'transition: all 10s;',
 | 
						|
                '.change::after': 'width: 100px;',
 | 
						|
                '.change::before': 'width: 100px;' });
 | 
						|
  // create two divs with these arrangement:
 | 
						|
  //       parent
 | 
						|
  //     ::before,
 | 
						|
  //     ::after
 | 
						|
  //        |
 | 
						|
  //       child
 | 
						|
  var parent = addDiv(t);
 | 
						|
  var child = addDiv(t);
 | 
						|
  parent.appendChild(child);
 | 
						|
 | 
						|
  parent.style.left = '0px';
 | 
						|
  parent.style.transition = 'left 10s';
 | 
						|
  parent.classList.add('init');
 | 
						|
  child.style.left = '0px';
 | 
						|
  child.style.transition = 'left 10s';
 | 
						|
  flushComputedStyle(parent);
 | 
						|
 | 
						|
  parent.style.left = '100px';
 | 
						|
  parent.classList.add('change');
 | 
						|
  child.style.left = '100px';
 | 
						|
 | 
						|
  var anims = document.getAnimations();
 | 
						|
  assert_equals(anims.length, 4,
 | 
						|
                'CSS transition on both pseudo-elements and elements ' +
 | 
						|
                'are returned');
 | 
						|
  assert_equals(anims[0].effect.target, parent,
 | 
						|
                'The animation targeting the parent element comes first');
 | 
						|
  assert_equals(anims[1].effect.target.type, '::before',
 | 
						|
                'The animation targeting the ::before element comes second');
 | 
						|
  assert_equals(anims[2].effect.target.type, '::after',
 | 
						|
                'The animation targeting the ::after element comes third');
 | 
						|
  assert_equals(anims[3].effect.target, child,
 | 
						|
                'The animation targeting the child element comes last');
 | 
						|
}, 'CSS Transitions targetting (pseudo-)elements should have correct order ' +
 | 
						|
   'after sorting');
 | 
						|
 | 
						|
async_test(function(t) {
 | 
						|
  var div = addDiv(t, { style: 'left: 0px; transition: all 50ms' });
 | 
						|
  flushComputedStyle(div);
 | 
						|
 | 
						|
  div.style.left = '100px';
 | 
						|
  var animations = div.getAnimations();
 | 
						|
  assert_equals(animations.length, 1, 'Got transition');
 | 
						|
  animations[0].finished.then(t.step_func(function() {
 | 
						|
    assert_equals(document.getAnimations().length, 0,
 | 
						|
                  'No animations returned');
 | 
						|
    t.done();
 | 
						|
  }));
 | 
						|
}, 'Transitions are not returned after they have finished');
 | 
						|
 | 
						|
</script>
 | 
						|
</body>
 |