OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>KeyframeEffectReadOnly spacing attribute tests</title> |
| 4 <link rel="help" |
| 5 href="https://w3c.github.io/web-animations/#dom-keyframeeffectreadonly-spacing"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="../../testcommon.js"></script> |
| 9 <body> |
| 10 <div id="log"></div> |
| 11 <script> |
| 12 "use strict"; |
| 13 |
| 14 test(function(t) { |
| 15 assert_throws(new TypeError, function() { |
| 16 createDiv(t).animate(null, { spacing: '' }); |
| 17 }); |
| 18 }, 'Test throwing TypeError if using empty string'); |
| 19 |
| 20 test(function(t) { |
| 21 assert_throws(new TypeError, function() { |
| 22 createDiv(t).animate(null, { spacing: 'dist' }); |
| 23 }); |
| 24 }, 'Test throwing TypeError if not using the correct keyword'); |
| 25 |
| 26 test(function(t) { |
| 27 assert_throws(new TypeError, function() { |
| 28 createDiv(t).animate(null, { spacing: ' paced(margin-left)' }); |
| 29 }); |
| 30 }, 'Test throwing TypeError if adding leading spaces'); |
| 31 |
| 32 test(function(t) { |
| 33 assert_throws(new TypeError, function() { |
| 34 createDiv(t).animate(null, { spacing: 'paced(margin-left) ' }); |
| 35 }); |
| 36 }, 'Test throwing TypeError if adding trailing spaces'); |
| 37 |
| 38 test(function(t) { |
| 39 assert_throws(new TypeError, function() { |
| 40 createDiv(t).animate(null, { spacing: 'paced( margin-left)' }); |
| 41 }); |
| 42 }, 'Test throwing TypeError if adding leading spaces before the ' + |
| 43 'paced property'); |
| 44 |
| 45 test(function(t) { |
| 46 assert_throws(new TypeError, function() { |
| 47 createDiv(t).animate(null, { spacing: 'paced(margin-left )' }); |
| 48 }); |
| 49 }, 'Test throwing TypeError if adding trailing spaces after the ' + |
| 50 'paced property'); |
| 51 |
| 52 test(function(t) { |
| 53 assert_throws(new TypeError, function() { |
| 54 createDiv(t).animate(null, { spacing: 'paced()' }); |
| 55 }); |
| 56 }, 'Test throwing TypeError if these is no paced property'); |
| 57 |
| 58 test(function(t) { |
| 59 assert_throws(new TypeError, function() { |
| 60 createDiv(t).animate(null, { spacing: 'paced(.margin)' }); |
| 61 }); |
| 62 }, 'Test throwing TypeError if using a non-ident started string'); |
| 63 |
| 64 test(function(t) { |
| 65 assert_throws(new TypeError, function() { |
| 66 createDiv(t).animate(null, { spacing: 'paced(1margin)' }); |
| 67 }); |
| 68 }, 'Test throwing TypeError if using a non-ident started string'); |
| 69 |
| 70 test(function(t) { |
| 71 assert_throws(new TypeError, function() { |
| 72 createDiv(t).animate(null, { spacing: 'paced(\\)' }); |
| 73 }); |
| 74 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 75 'an invalid escape'); |
| 76 |
| 77 test(function(t) { |
| 78 assert_throws(new TypeError, function() { |
| 79 createDiv(t).animate(null, { spacing: 'paced(\\\fmargin)' }); |
| 80 }); |
| 81 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 82 'an invalid escape (FF)'); |
| 83 |
| 84 test(function(t) { |
| 85 assert_throws(new TypeError, function() { |
| 86 createDiv(t).animate(null, { spacing: 'paced(\\\rmargin)' }); |
| 87 }); |
| 88 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 89 'an invalid escape (CR)'); |
| 90 |
| 91 test(function(t) { |
| 92 assert_throws(new TypeError, function() { |
| 93 createDiv(t).animate(null, { spacing: 'paced(\\\nmargin)' }); |
| 94 }); |
| 95 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 96 'an invalid escape (LF)'); |
| 97 |
| 98 test(function(t) { |
| 99 assert_throws(new TypeError, function() { |
| 100 createDiv(t).animate(null, { spacing: 'paced(- )' }); |
| 101 }); |
| 102 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 103 'a leading minus and an invalid name-start code point'); |
| 104 |
| 105 test(function(t) { |
| 106 assert_throws(new TypeError, function() { |
| 107 createDiv(t).animate(null, { spacing: 'paced(-\\)' }); |
| 108 }); |
| 109 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 110 'a leading minus and an invalid escape'); |
| 111 |
| 112 test(function(t) { |
| 113 assert_throws(new TypeError, function() { |
| 114 createDiv(t).animate(null, { spacing: 'paced(-\\\fmargin)' }); |
| 115 }); |
| 116 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 117 'a leading minus and an invalid escape (FF)'); |
| 118 |
| 119 test(function(t) { |
| 120 assert_throws(new TypeError, function() { |
| 121 createDiv(t).animate(null, { spacing: 'paced(-\\\rmargin)' }); |
| 122 }); |
| 123 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 124 'a leading minus and an invalid escape (CR)'); |
| 125 |
| 126 test(function(t) { |
| 127 assert_throws(new TypeError, function() { |
| 128 createDiv(t).animate(null, { spacing: 'paced(-\\\nmargin)' }); |
| 129 }); |
| 130 }, 'Test throwing TypeError if using a non-ident started string with ' + |
| 131 'a leading minus and an invalid escape (LF)'); |
| 132 |
| 133 test(function(t) { |
| 134 assert_throws(new TypeError, function() { |
| 135 createDiv(t).animate(null, { spacing: 'paced(--\\)' }); |
| 136 }); |
| 137 }, 'Test throwing TypeError if using a non-ident string with an invalid ' + |
| 138 'escape'); |
| 139 |
| 140 test(function(t) { |
| 141 assert_throws(new TypeError, function() { |
| 142 createDiv(t).animate(null, { spacing: 'paced(--\\\fmargin)' }); |
| 143 }); |
| 144 }, 'Test throwing TypeError if using a non-ident string with an invalid ' + |
| 145 'escape (FF)'); |
| 146 |
| 147 test(function(t) { |
| 148 assert_throws(new TypeError, function() { |
| 149 createDiv(t).animate(null, { spacing: 'paced(--\\\rmargin)' }); |
| 150 }); |
| 151 }, 'Test throwing TypeError if using a non-ident string with an invalid ' + |
| 152 'escape (CR)'); |
| 153 |
| 154 test(function(t) { |
| 155 assert_throws(new TypeError, function() { |
| 156 createDiv(t).animate(null, { spacing: 'paced(--\\\nmargin)' }); |
| 157 }); |
| 158 }, 'Test throwing TypeError if using a non-ident string with an invalid ' + |
| 159 'escape (LF)'); |
| 160 |
| 161 test(function(t) { |
| 162 assert_throws(new TypeError, function() { |
| 163 createDiv(t).animate(null, { spacing: 'paced(margin.left)' }); |
| 164 }); |
| 165 }, 'Test throwing TypeError if using a non-ident string with an invalid name ' + |
| 166 'code point'); |
| 167 |
| 168 test(function(t) { |
| 169 var anim = createDiv(t).animate(null, { spacing: 'paced(A)' }); |
| 170 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 171 }, 'Test falling back to distribute spacing if using a unrecognized property'); |
| 172 |
| 173 test(function(t) { |
| 174 var anim = createDiv(t).animate(null, { spacing: 'paced(\\.margin)' }); |
| 175 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 176 }, 'Test falling back to distribute spacing if using a unrecognized property ' + |
| 177 'which starts with a valid escape (Full stop)'); |
| 178 |
| 179 test(function(t) { |
| 180 var anim = createDiv(t).animate(null, { spacing: 'paced(\\ margin)' }); |
| 181 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 182 }, 'Test falling back to distribute spacing if using a unrecognized property ' + |
| 183 'which starts with a valid escape (white space)'); |
| 184 |
| 185 test(function(t) { |
| 186 var anim = createDiv(t).animate(null, { spacing: 'paced(_margin)' }); |
| 187 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 188 }, 'Test falling back to distribute spacing if using a unrecognized property ' + |
| 189 'which starts with a valid escape (low line)'); |
| 190 |
| 191 test(function(t) { |
| 192 var anim = createDiv(t).animate(null, { spacing: 'paced(-_margin)' }); |
| 193 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 194 }, 'Test falling back to distribute spacing if using a unrecognized property ' + |
| 195 'which starts with a minus and a low line'); |
| 196 |
| 197 test(function(t) { |
| 198 var anim = createDiv(t).animate(null, { spacing: 'paced(-\\.margin)' }); |
| 199 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 200 }, 'Test falling back to distribute spacing if using a unrecognized property ' + |
| 201 'which starts with a minus and a valid escape'); |
| 202 |
| 203 test(function(t) { |
| 204 var anim = createDiv(t).animate(null, { spacing: 'paced(--bg-color)' }); |
| 205 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 206 }, 'Test falling back to distribute spacing if using CSS variables'); |
| 207 |
| 208 test(function(t) { |
| 209 var anim = createDiv(t).animate(null, { spacing: 'paced(animation)' }); |
| 210 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 211 }, 'Test falling back to distribute spacing if using a non-animatable ' + |
| 212 'shorthand property'); |
| 213 |
| 214 test(function(t) { |
| 215 var anim = createDiv(t).animate(null, |
| 216 { spacing: 'paced(animation-duration)' }); |
| 217 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 218 }, 'Test falling back to distribute spacing if using a non-animatable ' + |
| 219 'property'); |
| 220 |
| 221 test(function(t) { |
| 222 var anim = createDiv(t).animate(null); |
| 223 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 224 }, 'Test default value of spacing'); |
| 225 |
| 226 test(function(t) { |
| 227 var anim = createDiv(t).animate(null, { spacing: 'distribute' }); |
| 228 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 229 }, 'Test spacing value if setting distribute'); |
| 230 |
| 231 test(function(t) { |
| 232 var anim = createDiv(t).animate(null, { spacing: 'paced(margin-left)' }); |
| 233 assert_equals(anim.effect.spacing, 'paced(margin-left)', 'spacing mode'); |
| 234 }, 'Test spacing value if setting paced'); |
| 235 |
| 236 </script> |
| 237 </body> |
OLD | NEW |