diff options
author | rafael lisboa <rafaelzlisboa@gmail.com> | 2015-04-09 15:29:42 -0300 |
---|---|---|
committer | rafael lisboa <rafaelzlisboa@gmail.com> | 2015-04-14 15:28:12 -0300 |
commit | ccbf5c43a954a2f890f9135f671f007de21c86aa (patch) | |
tree | 4b35fdc88d0d291d3cf3be87d75b5af668e28624 /web-ui/test/spec | |
parent | e339b4228ad8dadf37f52e6d87421da3c35d832a (diff) |
refactor mail item mixin creation and rendering
Diffstat (limited to 'web-ui/test/spec')
3 files changed, 13 insertions, 10 deletions
diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index 920709b2..9729ffb8 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -25,25 +25,29 @@ define(['helpers/view_helper'], function (viewHelper) { }); }); - describe('getFormmattedDate', function() { + describe('formatDate', function() { + var template; + beforeEach(function () { + template = Handlebars.compile("{{formatDate date}}"); + }); + it('formats correctly a Date for today', function() { var d = new Date(); - var dtest = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 14, 2, 36); - - var res = viewHelper.getFormattedDate(dtest); + var mailDate = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 14, 2, 36); - expect(res).toEqual('14:02'); + var result = template({ date: mailDate.toISOString() }); + expect(result).toEqual('14:02'); }); it('formats correctly a Date for a specific day', function() { - var dtest = new Date(2013, 2, 13, 7, 56, 1); + var mailDate = new Date(2013, 2, 13, 7, 56, 1); - var res = viewHelper.getFormattedDate(dtest); + var result = template({ date: mailDate.toISOString() }); // This expectation is weird for the month - JS Dates have date numbers be zero-indexed, thus the discrepancy // Specifically, the 2 in the constructor DOES match the 3 in the expectation below. - expect(res).toEqual('2013-03-13'); + expect(result).toEqual('2013-03-13'); }); }); diff --git a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js index 88735302..87d38595 100644 --- a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js @@ -7,11 +7,11 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () { mail = Pixelated.testData().parsedMail.simpleTextPlain; mail.tags = []; mail.mailbox = 'inbox'; + mail.currentTag = 'inbox'; this.setupComponent('<li></li>', { mail: mail, selected: false, - tag: 'inbox', templateType: 'single' }); }); diff --git a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js index b1ac3037..03f95e54 100644 --- a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js @@ -10,7 +10,6 @@ describeMixin('mail_list/ui/mail_items/mail_item', function () { selected: false, tag: 'inbox' }); - this.component.attachListeners(); }); describe('mail checkbox', function () { |