Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -425,7 +425,7 @@ const gCSSProperties = {
{ type: 'discrete', options: [ [ '"a"', '"b"' ] ] }
],
setup: t => {
return createPseudo(t, 'before');
return getPseudoElement(t, 'before');
}
},
'counter-increment': {

View file

@ -205,13 +205,13 @@ test(t => {
// Tests on CSSPseudoElement
test(t => {
const pseudoTarget = createPseudo(t, 'before');
const pseudoTarget = getPseudoElement(t, 'before');
const anim = pseudoTarget.animate(null);
assert_class_string(anim, 'Animation', 'The returned object is an Animation');
}, 'CSSPseudoElement.animate() creates an Animation object');
test(t => {
const pseudoTarget = createPseudo(t, 'before');
const pseudoTarget = getPseudoElement(t, 'before');
const anim = pseudoTarget.animate(null);
assert_equals(anim.effect.target, pseudoTarget,
'The returned Animation targets to the correct object');

View file

@ -41,6 +41,19 @@ test(t => {
'getAnimations() returns running animations');
}, 'Test the order of document.getAnimations with script generated animations')
test(t => {
// This element exists but is not a descendent of any document, so isn't
// picked up by getAnimations.
const div = document.createElement('div');
const anim = div.animate(gKeyFrames, 100 * MS_PER_SEC);
assert_equals(document.getAnimations().length, 0);
// Now connect the div; it should appear in the list of animations.
document.body.appendChild(div);
t.add_cleanup(() => { div.remove(); });
assert_equals(document.getAnimations().length, 1);
}, 'Test document.getAnimations for a disconnected node');
test(t => {
const effect = new KeyframeEffect(null, gKeyFrames, 100 * MS_PER_SEC);
const anim = new Animation(effect, document.timeline);

View file

@ -307,6 +307,20 @@ test(() => {
}, 'Keyframes are read from a custom iterator with where an offset is'
+ ' specified');
test(() => {
const test_error = { name: 'test' };
const bad_keyframe = { get left() { throw test_error; } };
assert_throws(test_error, () => {
new KeyframeEffect(null, createIterable([
{ done: false, value: { left: '100px' } },
{ done: false, value: bad_keyframe },
{ done: false, value: { left: '200px' } },
{ done: true },
]));
});
}, 'If a keyframe throws for an animatable property, that exception should be'
+ ' propagated');
test(() => {
assert_throws({ name: 'TypeError' }, () => {
new KeyframeEffect(null, createIterable([
@ -319,6 +333,36 @@ test(() => {
}, 'Reading from a custom iterator that returns a non-object keyframe'
+ ' should throw');
test(() => {
const effect = new KeyframeEffect(null, createIterable([
{ done: false, value: { left: '100px' } },
{ done: false }, // No value member; keyframe is undefined.
{ done: false, value: { left: '200px' } },
{ done: true },
]));
assert_frame_lists_equal(effect.getKeyframes(), [
{ left: '100px', offset: null, computedOffset: 0, easing: 'linear', composite: null },
{ offset: null, computedOffset: 0.5, easing: 'linear', composite: null },
{ left: '200px', offset: null, computedOffset: 1, easing: 'linear', composite: null },
]);
}, 'An undefined keyframe returned from a custom iterator should be treated as a'
+ ' default keyframe');
test(() => {
const effect = new KeyframeEffect(null, createIterable([
{ done: false, value: { left: '100px' } },
{ done: false, value: null },
{ done: false, value: { left: '200px' } },
{ done: true },
]));
assert_frame_lists_equal(effect.getKeyframes(), [
{ left: '100px', offset: null, computedOffset: 0, easing: 'linear', composite: null },
{ offset: null, computedOffset: 0.5, easing: 'linear', composite: null },
{ left: '200px', offset: null, computedOffset: 1, easing: 'linear', composite: null },
]);
}, 'A null keyframe returned from a custom iterator should be treated as a'
+ ' default keyframe');
test(() => {
const effect = new KeyframeEffect(null, createIterable([
{ done: false, value: { left: ['100px', '200px'] } },
@ -329,6 +373,44 @@ test(() => {
]);
}, 'A list of values returned from a custom iterator should be ignored');
test(() => {
const test_error = { name: 'test' };
const keyframe_obj = {
[Symbol.iterator]() {
return { next() { throw test_error; } };
},
};
assert_throws(test_error, () => {
new KeyframeEffect(null, keyframe_obj);
});
}, 'If a custom iterator throws from next(), the exception should be rethrown');
// Test handling of invalid Symbol.iterator
test(() => {
const test_error = { name: 'test' };
const keyframe_obj = {
[Symbol.iterator]() {
throw test_error;
},
};
assert_throws(test_error, () => {
new KeyframeEffect(null, keyframe_obj);
});
}, 'Accessing a Symbol.iterator property that throws should rethrow');
test(() => {
const keyframe_obj = {
[Symbol.iterator]() {
return 42; // Not an object.
},
};
assert_throws({ name: 'TypeError' }, () => {
new KeyframeEffect(null, keyframe_obj);
});
}, 'A non-object returned from the Symbol.iterator property should cause a'
+ ' TypeError to be thrown');
test(() => {
const keyframe = {};
Object.defineProperty(keyframe, 'width', { value: '200px' });

View file

@ -88,7 +88,7 @@ function createStyle(test, rules, doc) {
}
// Create a pseudo element
function createPseudo(test, type) {
function getPseudoElement(test, type) {
createStyle(test, { '@keyframes anim': '',
[`.pseudo::${type}`]: 'animation: anim 10s; ' +
'content: \'\';' });
@ -97,8 +97,6 @@ function createPseudo(test, type) {
const anims = document.getAnimations();
assert_true(anims.length >= 1);
const anim = anims[anims.length - 1];
assert_equals(anim.effect.target.parentElement, div);
assert_equals(anim.effect.target.type, `::${type}`);
anim.cancel();
return anim.effect.target;
}