mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
web animation updates
This commit is contained in:
35
scripts/vendor/web-animations-js/test/js/number-handler.js
vendored
Executable file
35
scripts/vendor/web-animations-js/test/js/number-handler.js
vendored
Executable file
@ -0,0 +1,35 @@
|
||||
suite('number-handler', function() {
|
||||
test('parse numbers', function() {
|
||||
var tests = {
|
||||
'0': 0,
|
||||
'1234': 1234,
|
||||
'-40': -40,
|
||||
'+40': 40,
|
||||
' -40 ': -40,
|
||||
'4.0': 4,
|
||||
'0.4': 0.4,
|
||||
'.1234': 0.1234,
|
||||
'12.34': 12.34,
|
||||
'+.1234': 0.1234,
|
||||
'+12.34': 12.34,
|
||||
'-.1234': -0.1234,
|
||||
'-12.34': -12.34,
|
||||
};
|
||||
for (var string in tests) {
|
||||
assert.equal(webAnimations1.parseNumber(string), tests[string], 'Parsing "' + string + '"');
|
||||
}
|
||||
});
|
||||
test('invalid numbers fail to parse', function() {
|
||||
assert.isUndefined(webAnimations1.parseNumber(''));
|
||||
assert.isUndefined(webAnimations1.parseNumber('nine'));
|
||||
assert.isUndefined(webAnimations1.parseNumber('1 2'));
|
||||
assert.isUndefined(webAnimations1.parseNumber('+-0'));
|
||||
assert.isUndefined(webAnimations1.parseNumber('50px'));
|
||||
assert.isUndefined(webAnimations1.parseNumber('1.2.3'));
|
||||
});
|
||||
test('opacity clamping', function() {
|
||||
var interpolation = webAnimations1.propertyInterpolation('opacity', '0', '1');
|
||||
assert.equal(interpolation(-1), '0');
|
||||
assert.equal(interpolation(2), '1');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user