• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 suite('property-interpolation', function() {
2   test('unmatched inputs return step interpolation', function() {
3     tests = [['unknown', 'input', 'tuple'],
4              ['unknown', '10px', '50px'],
5              ['width', '100px', 'auto'],
6              ['width', 'auto', '100px']];
7     for (var i = 0; i < tests.length; i++) {
8       var property = tests[i][0];
9       var left = tests[i][1];
10       var right = tests[i][2];
11       interpolation = webAnimations1.propertyInterpolation(property, left, right);
12       assert.equal(interpolation(-1), left);
13       assert.equal(interpolation(0), left);
14       assert.equal(interpolation(0.45), left);
15       assert.equal(interpolation(0.5), right);
16       assert.equal(interpolation(0.55), right);
17       assert.equal(interpolation(1), right);
18       assert.equal(interpolation(2), right);
19     }
20   });
21 
22   test('registers camel cased property names', function() {
23     function merge(a, b) {
24       return [a, b, function(x) { return a + b; }];
25     };
26     webAnimations1.addPropertiesHandler(Number, merge, ['dummy-property']);
27     assert.equal(webAnimations1.propertyInterpolation('dummy-property', 1, 2)(0.5), 3);
28     assert.equal(webAnimations1.propertyInterpolation('dummyProperty', 5, 3)(0.5), 8);
29   });
30 });
31