UNPKG

animated

Version:

Declarative Animations Library for React and React Native

427 lines (32 loc) 1.96 kB
'use strict';var _templateObject=_taggedTemplateLiteral(['width: 100px'],['width: 100px']),_templateObject2=_taggedTemplateLiteral(['width: ','px; height: ','px'],['width: ','px; height: ','px']);function _taggedTemplateLiteral(strings,raw){return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));} jest. autoMockOff(); var Animated=require('../index'); describe('Animated Templates',function(){ it('works with fully literal template string',function(){ var template=Animated.template(_templateObject); expect(template.__getValue()).toBe('width: 100px'); }); it('works with literal template that uses static values',function(){ var value=42; var template=Animated.template(_templateObject2,value,value); expect(template.__getValue()).toBe('width: 42px; height: 42px'); }); it('works with literal template that uses Animated values',function(){ var value=new Animated.Value(42); var template=Animated.template(_templateObject2,value,value); expect(template.__getValue()).toBe('width: 42px; height: 42px'); value.setValue(13); expect(template.__getValue()).toBe('width: 13px; height: 13px'); }); it('works with multiple different Animated values',function(){ var value1=new Animated.Value(42); var value2=new Animated.Value(13); var template=Animated.template(_templateObject2,value1,value2); expect(template.__getValue()).toBe('width: 42px; height: 13px'); value1.setValue(21); expect(template.__getValue()).toBe('width: 21px; height: 13px'); value2.setValue(66); expect(template.__getValue()).toBe('width: 21px; height: 66px'); }); });