diff options
author | Gislene Pereira <gislene01@gmail.com> | 2016-03-15 17:17:15 -0300 |
---|---|---|
committer | Gislene Pereira <gislene01@gmail.com> | 2016-03-15 17:17:15 -0300 |
commit | 28be7a424207a6e156adcb1746a6401f9bcabd85 (patch) | |
tree | b5aca7dbf7b4e8a1d28add633659437b6b1f6b89 /web-ui/app/js/page | |
parent | fc36290f708125a168e31b3b1e5b7282e6fd1059 (diff) |
Adding js unit tests + small refactoring. // pairing with @tuliocasagrande
Issue #238
Diffstat (limited to 'web-ui/app/js/page')
-rw-r--r-- | web-ui/app/js/page/default.js | 2 | ||||
-rw-r--r-- | web-ui/app/js/page/pix_logo.js | 29 |
2 files changed, 21 insertions, 10 deletions
diff --git a/web-ui/app/js/page/default.js b/web-ui/app/js/page/default.js index e119672f..965fb577 100644 --- a/web-ui/app/js/page/default.js +++ b/web-ui/app/js/page/default.js @@ -134,7 +134,7 @@ define( unreadCountTitle.attachTo(document); - pixLogo.attachTo('#pix-logo'); + pixLogo.attachTo(document); $.ajaxSetup({headers: {'X-XSRF-TOKEN': browser.getCookie('XSRF-TOKEN')}}); } 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); }); } } |