Mailspring/internal_packages/message-list/spec/message-timestamp-spec.cjsx
Ben Gotow a26b8d4bc4 fix(*): Resolve a variety of small and simple bugs
Summary:
Fix T1822 - saving templates not working, not showing template

Fix T1800 - give composers a minimum size

Fix the bottom bar of the composer so the gray bar goes all the way across in popout mode.

Fix T1825 - switch to a more attractive "June 4, 2015 at 3:10 PM" styling for expanded dates

Remove, rather than hide, react components for text fields in composer. Fixes T1147

Fix specs

Switch to 999+ instead of infinity. Fixes T1768

Fix broken TemplateStore specs

Test Plan: Run tests

Reviewers: evan

Reviewed By: evan

Maniphest Tasks: T1147, T1768, T1822, T1800, T1825

Differential Revision: https://phab.nylas.com/D1601
2015-06-05 11:02:44 -07:00

42 lines
1.6 KiB
CoffeeScript

moment = require 'moment'
React = require 'react/addons'
TestUtils = React.addons.TestUtils
MessageTimestamp = require '../lib/message-timestamp'
testDate = ->
moment([2010, 1, 14, 15, 25, 50, 125])
describe "MessageTimestamp", ->
beforeEach ->
@item = TestUtils.renderIntoDocument(
<MessageTimestamp date={testDate()} />
)
# test messsage time is 1415814587
it "displays the time from messages LONG ago", ->
spyOn(@item, "_today").andCallFake -> testDate().add(2, 'years')
expect(@item._timeFormat()).toBe "MMM D YYYY"
it "displays the time and date from messages a bit ago", ->
spyOn(@item, "_today").andCallFake -> testDate().add(2, 'days')
expect(@item._timeFormat()).toBe "MMM D, h:mm a"
it "displays the time and date messages exactly a day ago", ->
spyOn(@item, "_today").andCallFake -> testDate().add(1, 'day')
expect(@item._timeFormat()).toBe "MMM D, h:mm a"
it "displays the time from messages yesterday with the day, even though it's less than 24 hours ago", ->
spyOn(@item, "_today").andCallFake -> moment([2010, 1, 15, 2, 25, 50, 125])
expect(@item._timeFormat()).toBe "MMM D, h:mm a"
it "displays the time from messages recently", ->
spyOn(@item, "_today").andCallFake -> testDate().add(2, 'hours')
expect(@item._timeFormat()).toBe "h:mm a"
it "displays the full time when in detailed timestamp mode", ->
itemDetailed = TestUtils.renderIntoDocument(
<MessageTimestamp date={testDate()} isDetailed={true} />
)
spyOn(itemDetailed, "_today").andCallFake -> testDate()
expect(itemDetailed._timeFormat()).toBe "MMMM D, YYYY [at] h:mm A"