11import colorNames from '../shared/colors'
2- import createStringInterpolation from '../shared/stringInterpolation'
3- import createInterpolation from './createInterpolation '
2+ import createStringInterpolator from '../shared/stringInterpolation'
3+ import createInterpolator from './createInterpolator '
44import * as Globals from './Globals'
55
66beforeAll ( ( ) => {
77 Globals . injectColorNames ( colorNames )
8- Globals . injectStringInterpolation ( createStringInterpolation )
8+ Globals . injectStringInterpolator ( createStringInterpolator )
99} )
1010
1111describe ( 'Interpolation' , ( ) => {
1212 it ( 'should work with defaults' , ( ) => {
13- const interpolation = createInterpolation ( {
13+ const interpolation = createInterpolator ( {
1414 range : [ 0 , 1 ] ,
1515 output : [ 0 , 1 ] ,
1616 } )
@@ -22,14 +22,14 @@ describe('Interpolation', () => {
2222 } )
2323
2424 it ( 'should work with interpolation function as argument' , ( ) => {
25- const interpolation = createInterpolation ( value => `scale(${ value } )` )
25+ const interpolation = createInterpolator ( value => `scale(${ value } )` )
2626
2727 expect ( interpolation ( 0 ) ) . toBe ( 'scale(0)' )
2828 expect ( interpolation ( 10.5 ) ) . toBe ( 'scale(10.5)' )
2929 } )
3030
3131 it ( 'should work with range arrays as arguments' , ( ) => {
32- const interpolation = createInterpolation ( [ 0 , 1 ] , [ 100 , 200 ] )
32+ const interpolation = createInterpolator ( [ 0 , 1 ] , [ 100 , 200 ] )
3333
3434 expect ( interpolation ( 0 ) ) . toBe ( 100 )
3535 expect ( interpolation ( 0.5 ) ) . toBe ( 150 )
@@ -38,7 +38,7 @@ describe('Interpolation', () => {
3838 } )
3939
4040 it ( 'should work with output range' , ( ) => {
41- const interpolation = createInterpolation ( {
41+ const interpolation = createInterpolator ( {
4242 range : [ 0 , 1 ] ,
4343 output : [ 100 , 200 ] ,
4444 } )
@@ -50,7 +50,7 @@ describe('Interpolation', () => {
5050 } )
5151
5252 it ( 'should work with input range' , ( ) => {
53- const interpolation = createInterpolation ( {
53+ const interpolation = createInterpolator ( {
5454 range : [ 100 , 200 ] ,
5555 output : [ 0 , 1 ] ,
5656 } )
@@ -62,7 +62,7 @@ describe('Interpolation', () => {
6262 } )
6363
6464 it ( 'should work with keyframes without extrapolate' , ( ) => {
65- const interpolation = createInterpolation ( {
65+ const interpolation = createInterpolator ( {
6666 range : [ 0 , 1 , 2 ] ,
6767 output : [ 0.2 , 1 , 0.2 ] ,
6868 extrapolate : 'clamp' ,
@@ -72,7 +72,7 @@ describe('Interpolation', () => {
7272 } )
7373
7474 it ( 'should work with output ranges as string' , ( ) => {
75- const interpolation = createInterpolation ( {
75+ const interpolation = createInterpolator ( {
7676 range : [ 0 , 1 ] ,
7777 output : [ 'rgba(0, 100, 200, 0)' , 'rgba(50, 150, 250, 0.4)' ] ,
7878 } )
@@ -83,7 +83,7 @@ describe('Interpolation', () => {
8383 } )
8484
8585 it ( 'should work with output ranges as short hex string' , ( ) => {
86- const interpolation = createInterpolation ( {
86+ const interpolation = createInterpolator ( {
8787 range : [ 0 , 1 ] ,
8888 output : [ '#024' , '#9BF' ] ,
8989 } )
@@ -94,7 +94,7 @@ describe('Interpolation', () => {
9494 } )
9595
9696 it ( 'should work with output ranges as long hex string' , ( ) => {
97- const interpolation = createInterpolation ( {
97+ const interpolation = createInterpolator ( {
9898 range : [ 0 , 1 ] ,
9999 output : [ '#FF9500' , '#87FC70' ] ,
100100 } )
@@ -105,7 +105,7 @@ describe('Interpolation', () => {
105105 } )
106106
107107 it ( 'should work with output ranges with mixed hex and rgba strings' , ( ) => {
108- const interpolation = createInterpolation ( {
108+ const interpolation = createInterpolator ( {
109109 range : [ 0 , 1 ] ,
110110 output : [ 'rgba(100, 120, 140, .4)' , '#87FC70' ] ,
111111 } )
@@ -116,7 +116,7 @@ describe('Interpolation', () => {
116116 } )
117117
118118 it ( 'should work with negative and decimal values in string ranges' , ( ) => {
119- const interpolation = createInterpolation ( {
119+ const interpolation = createInterpolator ( {
120120 range : [ 0 , 1 ] ,
121121 output : [ '-100.5deg' , '100deg' ] ,
122122 } )
@@ -127,7 +127,7 @@ describe('Interpolation', () => {
127127 } )
128128
129129 it ( 'should support a mix of color patterns' , ( ) => {
130- const interpolation = createInterpolation ( {
130+ const interpolation = createInterpolator ( {
131131 range : [ 0 , 1 , 2 ] ,
132132 output : [ 'rgba(0, 100, 200, 0)' , 'rgb(50, 150, 250)' , 'red' ] ,
133133 } )
0 commit comments