From 28be7a424207a6e156adcb1746a6401f9bcabd85 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Tue, 15 Mar 2016 17:17:15 -0300 Subject: Adding js unit tests + small refactoring. // pairing with @tuliocasagrande Issue #238 --- web-ui/app/js/page/pix_logo.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index 70a8b3ab..58024a53 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -26,24 +26,35 @@ define( return defineComponent(pixLogo); function pixLogo() { - this.spinLogo = function (ev, data) { + this.turnAnimationOn = function () { $('.logo-part-animation-off').attr('class', 'logo-part-animation-on'); }; - this.stopSpinningLogo = function (ev, data) { + this.turnAnimationOff = function () { setTimeout(function(){ $('.logo-part-animation-on').attr('class', 'logo-part-animation-off'); }, 600); }; + this.triggerSpinLogo = function (ev, data) { + this.trigger(document, events.ui.page.spinLogo); + }; + + this.triggerStopSpinningLogo = function(ev, data) { + this.trigger(document, events.ui.page.stopSpinningLogo); + }; + this.after('initialize', function () { - this.on(document, events.ui.tag.select, this.spinLogo); - this.on(document, events.mails.available, this.stopSpinningLogo); - this.on(document, events.mail.saveDraft, this.spinLogo); - this.on(document, events.mail.draftSaved, this.stopSpinningLogo); - this.on(document, events.ui.mail.open, this.spinLogo); - this.on(document, events.dispatchers.rightPane.openDraft, this.spinLogo); - this.on(document, events.mail.want, this.stopSpinningLogo); + this.on(document, events.ui.page.spinLogo, this.turnAnimationOn); + this.on(document, events.ui.page.stopSpinningLogo, this.turnAnimationOff); + + this.on(document, events.ui.tag.select, this.triggerSpinLogo); + this.on(document, events.mails.available, this.triggerStopSpinningLogo); + this.on(document, events.mail.saveDraft, this.triggerSpinLogo); + this.on(document, events.mail.draftSaved, this.triggerStopSpinningLogo); + this.on(document, events.ui.mail.open, this.triggerSpinLogo); + this.on(document, events.dispatchers.rightPane.openDraft, this.triggerSpinLogo); + this.on(document, events.mail.want, this.triggerStopSpinningLogo); }); } } -- cgit v1.2.3