summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-03-17 11:57:45 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-03-17 11:57:45 +0000
commit4b8e98d483207beb4331ca3b728e106987f23603 (patch)
tree7e6e9e9b173ffb57a9007f61dd0d8d2bfcb34557
parent94566bb772f3a31aac9fe1b95c6ab4231a481bd0 (diff)
downloadmullvadvpn-4b8e98d483207beb4331ca3b728e106987f23603.tar.xz
mullvadvpn-4b8e98d483207beb4331ca3b728e106987f23603.zip
Add tests for advanceToStart() and advanceToEnd() in both direct/reverse animation orders
-rw-r--r--test/tray-animator.spec.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/tray-animator.spec.js b/test/tray-animator.spec.js
index c22cdb7a25..c6eaea24e6 100644
--- a/test/tray-animator.spec.js
+++ b/test/tray-animator.spec.js
@@ -20,6 +20,58 @@ describe('lib/tray-animator', function() {
}
});
+ it('should advance to start', (done) => {
+ const tray = {
+ setImage: () => {
+ expect(animation._currentFrame).to.be.equal(0);
+ done();
+ }
+ };
+
+ animator = new TrayAnimator(tray, animation);
+ animator.advanceToStart();
+ });
+
+ it('should advance to end', (done) => {
+ const tray = {
+ setImage: () => {
+ expect(animation._currentFrame).to.be.equal(4);
+ done();
+ }
+ };
+
+ animator = new TrayAnimator(tray, animation);
+ animator.advanceToEnd();
+ });
+
+ it('should advance to start when in reverse', (done) => {
+ const tray = {
+ setImage: () => {
+ expect(animation._currentFrame).to.be.equal(4);
+ done();
+ }
+ };
+
+ animation.reverse = true;
+
+ animator = new TrayAnimator(tray, animation);
+ animator.advanceToStart();
+ });
+
+ it('should advance to end when in reverse', (done) => {
+ const tray = {
+ setImage: () => {
+ expect(animation._currentFrame).to.be.equal(0);
+ done();
+ }
+ };
+
+ animation.reverse = true;
+
+ animator = new TrayAnimator(tray, animation);
+ animator.advanceToEnd();
+ });
+
it('should play sequence', (done) => {
let seq = [];