Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / virtual / stable / web-animations-api / partial-keyframes-unsupported.html
blob48e381a3e833a54d7a2c4bf2e50c82d29f9e6844
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
5 <body>
6 <div id='e'></div>
7 </body>
9 <script>
10 var element = document.getElementById('e');
12 test(function() {
13 var partialKeyframes1 = [
14 {opacity: '1', color: 'red'},
15 {opacity: '0'}
17 var partialKeyframes2 = [
18 {opacity: '1'},
19 {opacity: '0', color: 'red'}
21 var partialKeyframes3 = [
22 {opacity: '1', color: 'red'},
23 {opacity: '0', color: 'foo'}
25 var partialKeyframes4 = [
26 {opacity: '1', color: 'foo'},
27 {opacity: '0', color: 'red'}
30 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes1); });
31 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes2); });
32 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes3); });
33 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes4); });
34 }, 'Calling element.animate() with a mismatched keyframe property should throw a NotSupportedError.');
36 test(function() {
37 var validKeyframes1 = [
38 {opacity: '1'},
39 {opacity: '0.3', offset: 0.5},
40 {opacity: '0', offset: 1}
42 var validKeyframes2 = [
43 {width: '0px'},
44 {height: '0px', offset: 0},
45 {width: '10px', height: '10px', offset: 1}
48 assert_not_equals(element.animate(validKeyframes1), undefined);
49 assert_not_equals(element.animate(validKeyframes2), undefined);
50 }, 'Calling element.animate() with no offset specified for the first keyframe should create and animation.');
52 test(function() {
53 var partialKeyframes1 = [
54 {opacity: '1', offset: 0.1},
55 {opacity: '0', offset: 1}
57 var partialKeyframes2 = [
58 {opacity: '1', offset: 0.1},
59 {opacity: '0'}
62 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes1); });
63 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes2); });
64 }, 'Calling element.animate() with the offset of the first keyframe specified but not equal to 0 should throw a NotSupportedError.');
66 test(function() {
67 var validKeyframes1 = [
68 {opacity: '1', offset: 0},
69 {opacity: '0.3', offset: 0.5},
70 {opacity: '0'}
72 var validKeyframes2 = [
73 {width: '0px', height: '0px', offset: 0},
74 {height: '10px', offset: 1},
75 {width: '10px'}
78 assert_not_equals(element.animate(validKeyframes1), undefined);
79 assert_not_equals(element.animate(validKeyframes2), undefined);
80 }, 'Calling element.animate() with no offset specified for the last keyframe should create an animation.');
82 test(function() {
83 var partialKeyframes1 = [
84 {opacity: '1', offset: 0},
85 {opacity: '0', offset: 0.1}
87 var partialKeyframes2 = [
88 {opacity: '1'},
89 {opacity: '0', offset: 0.1}
92 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes1); });
93 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes2); });
94 }, 'Calling element.animate() with the offset of the last keyframe specified but not equal to 1 should throw a NotSupportedError.');
96 test(function() {
97 var partialKeyframes1 = [
98 {width: '0px', height: '0px', offset: 0},
99 {height: '10px'},
100 {width: '10px', offset: 1}
102 var partialKeyframes2 = [
103 {width: '0px', height: '0px', offset: 0},
104 {height: '10px'},
105 {width: '10px'}
108 // Height is missing keyframe at offset: 1
109 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes1); });
110 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes2); });
111 }, 'Calling element.animate() with a keyframe that has no offset specified, is followed by other keyframes, ' +
112 'and is the last keyframe for a property, should throw a NotSupportedError.');
114 test(function() {
115 var partialKeyframes1 = [
116 {width: '0px', offset: 0},
117 {height: '0px'},
118 {width: '10px', height: '10px', offset: 1}
120 var partialKeyframes2 = [
121 {width: '0px'},
122 {height: '0px'},
123 {width: '10px', height: '10px', offset: 1}
126 // Height is missing keyframe at offset: 0
127 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes1); });
128 assert_throws('NOT_SUPPORTED_ERR', function() { element.animate(partialKeyframes2); });
129 }, 'Calling element.animate() with a keyframe that has no offset specified, is preceded by other keyframes, ' +
130 'and is the first keyframe for a property, should throw a NotSupportedError.');
131 </script>