Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: LayoutTests/web-animations-api/animation-constructor.html

Issue 190763007: [WIP] Web Animations API: Constructing an Animation from partial keyframes throws a JS exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add FIXME for keyframes at 0 and 1. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/web-animations-api/animation-constructor.html
diff --git a/LayoutTests/web-animations-api/animation-constructor.html b/LayoutTests/web-animations-api/animation-constructor.html
index 0a679cdabdda1dc950c33d88cbdd84ce1870bcc6..83bde2ead7dedc5cb378557ebfb2dd528e0294d2 100644
--- a/LayoutTests/web-animations-api/animation-constructor.html
+++ b/LayoutTests/web-animations-api/animation-constructor.html
@@ -9,32 +9,72 @@
<script>
var element = document.getElementById('e');
-var animationWithTimingObject = new Animation(element,
- [{opacity: '1', offset: 0},
- {opacity: '0', offset: 1}],
- {duration: 2, iterations: 5});
-
-var animationWithDuration = new Animation(element,
- [{opacity: '1', offset: 0},
- {opacity: '0', offset: 1}],
- 2);
-
-var animationNoTiming = new Animation(element,
- [{opacity: '1', offset: 0},
- {opacity: '0', offset: 1}]);
-
test(function() {
+ var animationWithTimingObject = new Animation(element,
+ [{opacity: '1', offset: 0},
+ {opacity: '0', offset: 1}],
+ {duration: 2, iterations: 5});
+
assert_false(animationWithTimingObject == undefined);
assert_equals(animationWithTimingObject.constructor, Animation);
}, 'Calling new Animation() with a timing object input should create an animation.');
test(function() {
+ var animationWithDuration = new Animation(element,
+ [{opacity: '1', offset: 0},
+ {opacity: '0', offset: 1}],
+ 2);
+
assert_false(animationWithDuration == undefined);
assert_equals(animationWithDuration.constructor, Animation);
}, 'Calling new Animation() with a duration input should create an animation.');
test(function() {
+ var animationNoTiming = new Animation(element,
+ [{opacity: '1', offset: 0},
+ {opacity: '0', offset: 1}]);
+
assert_false(animationNoTiming == undefined);
assert_equals(animationNoTiming.constructor, Animation);
}, 'Calling new Animation() with no timing input should create an animation.');
-</script>
+
+test(function() {
+ var partialKeyframes1 = [
+ {opacity: '1', color: 'red', offset: 0},
+ {opacity: '0', offset: 1}];
+ var partialKeyframes2 = [
+ {opacity: '1', color: 'red', offset: 0},
+ {opacity: '0', color: 'foo', offset: 1}];
+
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes1); });
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes2); });
+}, 'Calling new Animation() with a mismatched keyframe property should throw a NotSupportedError.');
+
+test(function() {
+ var validKeyframes = [
+ {opacity: '1', offset: 0},
+ {opacity: '0', offset: 1}];
+ var partialKeyframes1 = [
+ {opacity: '1', offset: 0.1},
+ {opacity: '0', offset: 1}];
+ var partialKeyframes2 = [
+ {opacity: '1', offset: 0.1},
+ {opacity: '0', offset: 0.2}];
+ var partialKeyframes3 = [
+ {opacity: '1', offset: 0.5},
+ {opacity: '0'}];
+
+ assert_not_equals(function() { new Animation(element, validKeyframes); }, undefined);
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes1); });
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes2); });
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes3); });
+}, 'Calling animate() with specified offsets but no keframe for offset: 0 should throw a NotSupportedError.');
+
+test(function() {
+ var partialKeyframes1 = [
+ {opacity: '1', offset: 0},
+ {opacity: '0', offset: 0.1}];
+
+ assert_throws('NOT_SUPPORTED_ERR', function() { new Animation(element, partialKeyframes1); });
+}, 'Calling animate() with specified offsets but no keyframe for offset: 1 should throw a NotSupportedError.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698