Automatic update from web-platform-tests Add a test for using DOMParser output with XSLTProcessor. This test verifies that a Document parsed by DOMParser can be successfully imported into an XSLTProcessor and used to transform another Document, producing the expected HTML output. Needed in Blink to verify whether we can independently switch the XML parser for DOMParser while still process XSLT. Bug: 441911594, 466303347 Change-Id: Ie4b3bffa1d0f6ff799f29b36bedf2d56d33fca91 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7254057 Auto-Submit: Dominik Röttsches <drott@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1558261} -- wpt-commits: 6868b09c4e59c3ef9d222f791f5649b4437f73d9 wpt-pr: 56719
112 lines
4.7 KiB
HTML
112 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>KeyframeEffect copy constructor</title>
|
|
<link rel="help"
|
|
href="https://drafts.csswg.org/web-animations/#dom-keyframeeffect-keyframeeffect-source">
|
|
<link rel="help"
|
|
href="https://drafts.csswg.org/web-animations/#dom-keyframeeffectreadonly-keyframeeffectreadonly-source">
|
|
<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(t => {
|
|
const effect = new KeyframeEffect(createDiv(t), null);
|
|
const copiedEffect = new KeyframeEffect(effect);
|
|
assert_equals(copiedEffect.target, effect.target, 'same target');
|
|
}, 'Copied KeyframeEffect has the same target');
|
|
|
|
test(t => {
|
|
const target = createElement(t, 'input');
|
|
target.setAttribute('type', 'input');
|
|
target.setAttribute('placeholder', "hello");
|
|
let effect = undefined;
|
|
try {
|
|
// Pseudo-elements for which the user agent has no usable level of support
|
|
// are deemed invalid. Test passes if no effect is generated.
|
|
effect = new KeyframeEffect(target, [], { pseudoElement: '::placeholder' });
|
|
} catch (e) {}
|
|
if (effect) {
|
|
// If an effect is generated (UA supports the pseudo), then the copy
|
|
// constructor is to retain the correct target.
|
|
const copy = new KeyframeEffect(effect);
|
|
assert_equals(copy.target, target);
|
|
}
|
|
}, 'Copied KeyframeEffect does not expose UA-shadow DOM');
|
|
|
|
test(t => {
|
|
const effect =
|
|
new KeyframeEffect(null,
|
|
[ { marginLeft: '0px' },
|
|
{ marginLeft: '-20px', easing: 'ease-in',
|
|
offset: 0.1 },
|
|
{ marginLeft: '100px', easing: 'ease-out' },
|
|
{ marginLeft: '50px' } ]);
|
|
|
|
const copiedEffect = new KeyframeEffect(effect);
|
|
const keyframesA = effect.getKeyframes();
|
|
const keyframesB = copiedEffect.getKeyframes();
|
|
assert_equals(keyframesA.length, keyframesB.length, 'same keyframes length');
|
|
|
|
for (let i = 0; i < keyframesA.length; ++i) {
|
|
assert_equals(keyframesA[i].offset, keyframesB[i].offset,
|
|
`Keyframe ${i} has the same offset`);
|
|
assert_equals(keyframesA[i].computedOffset, keyframesB[i].computedOffset,
|
|
`Keyframe ${i} has the same computedOffset`);
|
|
assert_equals(keyframesA[i].easing, keyframesB[i].easing,
|
|
`Keyframe ${i} has the same easing`);
|
|
assert_equals(keyframesA[i].composite, keyframesB[i].composite,
|
|
`Keyframe ${i} has the same composite`);
|
|
|
|
assert_true(!!keyframesA[i].marginLeft,
|
|
`Original keyframe ${i} has a valid property value`);
|
|
assert_true(!!keyframesB[i].marginLeft,
|
|
`New keyframe ${i} has a valid property value`);
|
|
assert_equals(keyframesA[i].marginLeft, keyframesB[i].marginLeft,
|
|
`Keyframe ${i} has the same property value pair`);
|
|
}
|
|
}, 'Copied KeyframeEffect has the same keyframes');
|
|
|
|
test(t => {
|
|
const effect =
|
|
new KeyframeEffect(null, null, { iterationComposite: 'accumulate' });
|
|
|
|
const copiedEffect = new KeyframeEffect(effect);
|
|
assert_equals(copiedEffect.iterationComposite, effect.iterationComposite,
|
|
'same iterationCompositeOperation');
|
|
assert_equals(copiedEffect.composite, effect.composite,
|
|
'same compositeOperation');
|
|
}, 'Copied KeyframeEffect has the same KeyframeEffectOptions');
|
|
|
|
test(t => {
|
|
const effect = new KeyframeEffect(null, null,
|
|
{ duration: 100 * MS_PER_SEC,
|
|
delay: -1 * MS_PER_SEC,
|
|
endDelay: 2 * MS_PER_SEC,
|
|
fill: 'forwards',
|
|
iterationStart: 2,
|
|
iterations: 20,
|
|
easing: 'ease-out',
|
|
direction: 'alternate' } );
|
|
|
|
const copiedEffect = new KeyframeEffect(effect);
|
|
const timingA = effect.getTiming();
|
|
const timingB = copiedEffect.getTiming();
|
|
assert_not_equals(timingA, timingB, 'different timing objects');
|
|
assert_equals(timingA.delay, timingB.delay, 'same delay');
|
|
assert_equals(timingA.endDelay, timingB.endDelay, 'same endDelay');
|
|
assert_equals(timingA.fill, timingB.fill, 'same fill');
|
|
assert_equals(timingA.iterationStart, timingB.iterationStart,
|
|
'same iterationStart');
|
|
assert_equals(timingA.iterations, timingB.iterations, 'same iterations');
|
|
assert_equals(timingA.duration, timingB.duration, 'same duration');
|
|
assert_equals(timingA.direction, timingB.direction, 'same direction');
|
|
assert_equals(timingA.easing, timingB.easing, 'same easing');
|
|
}, 'Copied KeyframeEffect has the same timing content');
|
|
|
|
</script>
|
|
</body>
|