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

Side by Side Diff: third_party/WebKit/LayoutTests/web-animations-api/w3c/simple-keyframes.html

Issue 2138333002: Cleaned up simple-keyframes.html test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fix Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Animate() with no offsets</title>
4 <link rel="help" href="https://w3c.github.io/web-animations/#keyframe-animation- effects">
2 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
4 <script src="resources/keyframes-test.js"></script> 7 <script src="../../imported/wpt/web-animations/testcommon.js"></script>
8 <body>
5 <script> 9 <script>
6 test(function() { 10 'use strict';
7 assertAnimationStyles([ 11 test(function(t) {
12 var keyframes = [
8 {opacity: '0.25', left: '25px'}, 13 {opacity: '0.25', left: '25px'},
9 {opacity: '0.75', left: '75px'}, 14 {opacity: '0.75', left: '75px'},
10 ], { 15 ];
16 var expectations = {
11 0.5: {opacity: '0.5', left: '50px'}, 17 0.5: {opacity: '0.5', left: '50px'},
12 }); 18 };
13 }, 19 for (var progress in expectations) {
14 'element.animate() with 2 keyframes', 20 var element = createDiv(t);
15 { 21 element.animate(keyframes, {
16 help: 'http://dev.w3.org/fxtf/web-animations/#keyframe-animation-effects', 22 duration: 1000,
17 assert: [ 23 fill: 'forwards',
18 'element.animate() should start an animation when two keyframes', 24 delay: -progress * 1000,
19 'are provided with matching properties and no offsets specified.', 25 });
20 ], 26 var computedStyle = getComputedStyle(element);
21 author: 'Alan Cutter', 27 for (var property in expectations[progress]) {
22 }); 28 assert_equals(computedStyle[property], expectations[progress][property],
29 property + ' at ' + (progress * 100) + '%');
30 }
31 }
32 }, 'element.animate() with 2 keyframes');
23 33
24 test(function() { 34 test(function(t) {
25 assertAnimationStyles([ 35 var keyframes =[
26 {opacity: '0', left: '0px'}, 36 {opacity: '0', left: '0px'},
27 {opacity: '0.25', left: '25px'}, 37 {opacity: '0.25', left: '25px'},
28 {opacity: '0.75', left: '75px'}, 38 {opacity: '0.75', left: '75px'},
29 ], { 39 ];
40 var expectations = {
30 0.25: {opacity: '0.125', left: '12.5px'}, 41 0.25: {opacity: '0.125', left: '12.5px'},
31 0.75: {opacity: '0.5', left: '50px'}, 42 0.75: {opacity: '0.5', left: '50px'},
32 }); 43 };
33 }, 44 for (var progress in expectations) {
34 'element.animate() with 3 keyframes', 45 var element = createDiv(t);
35 { 46 element.animate(keyframes, {
36 help: 'http://dev.w3.org/fxtf/web-animations/#keyframe-animation-effects', 47 duration: 1000,
37 assert: [ 48 fill: 'forwards',
38 'element.animate() should start an animation when three keyframes', 49 delay: -progress * 1000,
39 'are provided with matching properties and no offsets specified.', 50 });
40 'The keyframes must maintain their ordering and get distributed', 51 var computedStyle = getComputedStyle(element);
41 'correctly.', 52 for (var property in expectations[progress]) {
42 ], 53 assert_equals(computedStyle[property], expectations[progress][property],
43 author: 'Alan Cutter', 54 property + ' at ' + (progress * 100) + '%');
44 }); 55 }
56 }
57 }, 'element.animate() with 3 keyframes');
45 </script> 58 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698