OLD | NEW |
(Empty) | |
| 1 suite('number-handler', function() { |
| 2 test('parse numbers', function() { |
| 3 var tests = { |
| 4 '0': 0, |
| 5 '1234': 1234, |
| 6 '-40': -40, |
| 7 '+40': 40, |
| 8 ' -40 ': -40, |
| 9 '4.0': 4, |
| 10 '0.4': 0.4, |
| 11 '.1234': 0.1234, |
| 12 '12.34': 12.34, |
| 13 '+.1234': 0.1234, |
| 14 '+12.34': 12.34, |
| 15 '-.1234': -0.1234, |
| 16 '-12.34': -12.34, |
| 17 }; |
| 18 for (var string in tests) { |
| 19 assert.equal(webAnimationsMinifill.parseNumber(string), tests[string], 'Pa
rsing "' + string + '"'); |
| 20 } |
| 21 }); |
| 22 test('invalid numbers fail to parse', function() { |
| 23 assert.isUndefined(webAnimationsMinifill.parseNumber('')); |
| 24 assert.isUndefined(webAnimationsMinifill.parseNumber('nine')); |
| 25 assert.isUndefined(webAnimationsMinifill.parseNumber('1 2')); |
| 26 assert.isUndefined(webAnimationsMinifill.parseNumber('+-0')); |
| 27 assert.isUndefined(webAnimationsMinifill.parseNumber('50px')); |
| 28 assert.isUndefined(webAnimationsMinifill.parseNumber('1.2.3')); |
| 29 }); |
| 30 test('opacity clamping', function() { |
| 31 var interpolation = webAnimationsMinifill.propertyInterpolation('opacity', '
0', '1'); |
| 32 assert.equal(interpolation(-1), '0'); |
| 33 assert.equal(interpolation(2), '1'); |
| 34 }); |
| 35 }); |
OLD | NEW |