-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new generate animation config (#157)
* created new config * Animation config composing * Fixing crash * Remove test style configs, export AnimationBuilder from lib * Add AnimationBuilder class * Add handling of stylesQueue from AnimationBuilder in useAnimationAPI * Update todos * Animation Builder is working * fixed crash without new config * add test for one animation * fixed animations bug and tests * Remaining animations, cleaning, tests * Animation builder tests * Docs update * fix: fixed all eslint/typescript errors and warnings * fix: deleted unneccessary fn export * chore: deleted comment Co-authored-by: mateki0 <mateki0@interia.pl> Co-authored-by: Daniel Grychtoł <grychtol.daniel@gmail.com>
- Loading branch information
1 parent
6029a50
commit 095b844
Showing
10 changed files
with
560 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { mergeStylesFunctions } from 'src/core/hooks/useAnimationAPI' | ||
import { | ||
AnimationBuilder, | ||
FadeIn, | ||
MoveDownAnimation, | ||
MoveUpAnimation, | ||
RotateZIn, | ||
SlideInLeftAnimation, | ||
CrazyAnimationConfig, | ||
} from 'src/core/utils/generateAnimationConfig' | ||
|
||
describe('props merger tests', function () { | ||
it('should make an instance from class', () => { | ||
const MoveDown = new AnimationBuilder(MoveDownAnimation) | ||
|
||
expect(MoveDown).toMatchObject(MoveDownAnimation) | ||
}) | ||
|
||
it('should merge styles properly with add method', () => { | ||
const MoveDown = new AnimationBuilder(MoveDownAnimation) | ||
const MoveDownFadeIn = FadeIn.add(MoveDown).transitionInStylesQueue | ||
const styles = mergeStylesFunctions(MoveDownFadeIn, { value: 1 }) | ||
|
||
expect(styles).toMatchObject({ | ||
opacity: 1, | ||
transform: [{ translateY: 0 }, { translateX: 0 }, { translateX: 0 }, { translateY: 0 }], | ||
}) | ||
}) | ||
it('should merge animationConfigIn properly with add method outstyles', () => { | ||
const SlideInLeft = new AnimationBuilder(SlideInLeftAnimation) | ||
const SlideInLeftCrazy = SlideInLeft.add(CrazyAnimationConfig).animationConfigIn | ||
|
||
const configIn = CrazyAnimationConfig.animationConfigIn | ||
|
||
expect(SlideInLeftCrazy).toMatchObject(configIn) | ||
}) | ||
it('should merge styles properly with add method outstyles', () => { | ||
const MoveUp = new AnimationBuilder(MoveUpAnimation) | ||
const MoveUpRotateZIn = RotateZIn.add(MoveUp).transitionOutStylesQueue | ||
const styles = mergeStylesFunctions(MoveUpRotateZIn, { value: 1 }) | ||
|
||
expect(styles).toMatchObject({ | ||
opacity: 1, | ||
transform: [{ translateY: 0 }, { translateX: 0 }, { translateY: 0 }], | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.