fune/testing/web-platform/tests/css/css-transitions/KeyframeEffect-target.tentative.html
Brian Birtles c23be2ef0f Bug 1467344 - Move tests from dom/animations/tests/css-transitions to WPT; r=hiro
--HG--
rename : dom/animation/test/css-transitions/test_animation-computed-timing.html => testing/web-platform/tests/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html
rename : dom/animation/test/css-transitions/test_pseudoElement-get-animations.html => testing/web-platform/tests/css/css-transitions/CSSPseudoElement-getAnimations.tentative.html
rename : dom/animation/test/css-transitions/test_animation-cancel.html => testing/web-platform/tests/css/css-transitions/CSSTransition-canceling.tentative.html
rename : dom/animation/test/css-transitions/test_animation-currenttime.html => testing/web-platform/tests/css/css-transitions/CSSTransition-currentTime.tentative.html
rename : dom/animation/test/css-transitions/test_setting-effect.html => testing/web-platform/tests/css/css-transitions/CSSTransition-effect.tentative.html
rename : dom/animation/test/css-transitions/test_animation-finished.html => testing/web-platform/tests/css/css-transitions/CSSTransition-finished.tentative.html
rename : dom/animation/test/css-transitions/test_animation-ready.html => testing/web-platform/tests/css/css-transitions/CSSTransition-ready.tentative.html
rename : dom/animation/test/css-transitions/test_animation-starttime.html => testing/web-platform/tests/css/css-transitions/CSSTransition-startTime.tentative.html
rename : dom/animation/test/css-transitions/test_csstransition-transitionproperty.html => testing/web-platform/tests/css/css-transitions/CSSTransition-transitionProperty.tentative.html
rename : dom/animation/test/css-transitions/test_document-get-animations.html => testing/web-platform/tests/css/css-transitions/Document-getAnimations.tentative.html
rename : dom/animation/test/css-transitions/test_element-get-animations.html => testing/web-platform/tests/css/css-transitions/Element-getAnimations.tentative.html
rename : dom/animation/test/css-transitions/test_keyframeeffect-getkeyframes.html => testing/web-platform/tests/css/css-transitions/KeyframeEffect-getKeyframes.tentative.html
rename : dom/animation/test/css-transitions/test_effect-target.html => testing/web-platform/tests/css/css-transitions/KeyframeEffect-target.tentative.html
rename : dom/animation/test/css-transitions/test_event-dispatch.html => testing/web-platform/tests/css/css-transitions/event-dispatch.tentative.html
extra : rebase_source : f09d4ff00f5be59ec5f90b211eebb074bdc17781
2018-08-16 14:41:04 +09:00

67 lines
2.7 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<title>CSSTransition.effect.target</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.js"></script>
<div id="log"></div>
<script>
'use strict';
test(t => {
const div = addDiv(t);
div.style.left = '0px';
getComputedStyle(div).transitionProperty;
div.style.transition = 'left 100s';
div.style.left = '100px';
const animation = div.getAnimations()[0];
assert_equals(animation.effect.target, div,
'Animation.target is the animatable div');
}, 'Returned CSS transitions have the correct Animation.target');
test(t => {
addStyle(t, { '.init::after': 'content: ""; width: 0px; height: 0px; ' +
'transition: all 10s;',
'.change::after': 'width: 100px; height: 100px;' });
const div = addDiv(t, { class: 'init' });
getComputedStyle(div).width;
div.classList.add('change');
const anims = document.getAnimations();
assert_equals(anims.length, 2,
'Got transitions running on ::after pseudo element');
assert_equals(anims[0].effect.target, anims[1].effect.target,
'Both transitions return the same target object');
}, 'effect.target should return the same CSSPseudoElement object each time');
test(t => {
addStyle(t, { '.init::after': 'content: ""; width: 0px; transition: all 10s;',
'.change::after': 'width: 100px;' });
const div = addDiv(t, { class: 'init' });
getComputedStyle(div).width;
div.classList.add('change');
const pseudoTarget = document.getAnimations()[0].effect.target;
const effect = new KeyframeEffect(pseudoTarget,
{ background: ["blue", "red"] },
3000);
const newAnim = new Animation(effect, document.timeline);
newAnim.play();
const anims = document.getAnimations();
assert_equals(anims.length, 2,
'Got animations running on ::after pseudo element');
assert_not_equals(anims[0], newAnim,
'The scriped-generated animation appears last');
assert_equals(newAnim.effect.target, pseudoTarget,
'The effect.target of the scripted-generated animation is ' +
'the same as the one from the argument of ' +
'KeyframeEffect constructor');
assert_equals(anims[0].effect.target, newAnim.effect.target,
'Both the transition and the scripted-generated animation ' +
'return the same target object');
}, 'effect.target from the script-generated animation should return the same ' +
'CSSPseudoElement object as that from the CSS generated transition');
</script>