additween-mocks
Mocks for the additween animation library. It can be used with any testing framework (in the usage example below we use jasmine).
It works by replacing some methods of additween
with its stub implementations, which allow to synchronously move animation internal clock forward.
How to install
npm install additween-mocks --save
Usage example
;; ;
Mock API
mock = new AdditiveTweeningMock()
Creates a new instance of mocking library.
mock.install(AdditiveTweening)
Pass an AdditiveTweening
constructor in order to patch its animation-related methods.
mock.uninstall(AdditiveTweening)
Restores original implementation of passed in AdditiveTweening
.
mock.tick(duration)
Moves animation clock forward by duration
msecs. Animation onRender
callback will be called once after that. If duration is greater or equal than total animation duration, onFinish
callback also will be called.
mock.reset()
Reset animation clock to its initial state.
License
MIT (http://www.opensource.org/licenses/mit-license.php)