mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 11:16:10 +08:00
fix:(specs) for message list
This commit is contained in:
parent
231f31ecf7
commit
911d7f961d
2 changed files with 13 additions and 11 deletions
|
@ -212,6 +212,7 @@ describe "MessageList", ->
|
||||||
describe "Populated Message list", ->
|
describe "Populated Message list", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
MessageStore._items = testMessages
|
MessageStore._items = testMessages
|
||||||
|
MessageStore._expandItemsToDefault()
|
||||||
MessageStore.trigger(MessageStore)
|
MessageStore.trigger(MessageStore)
|
||||||
@message_list.setState currentThread: test_thread
|
@message_list.setState currentThread: test_thread
|
||||||
|
|
||||||
|
@ -220,6 +221,10 @@ describe "MessageList", ->
|
||||||
MessageItem)
|
MessageItem)
|
||||||
expect(items.length).toBe 5
|
expect(items.length).toBe 5
|
||||||
|
|
||||||
|
it "renders the correct number of expanded messages", ->
|
||||||
|
msgs = TestUtils.scryRenderedDOMComponentsWithClass(@message_list, "message-item-wrap collapsed")
|
||||||
|
expect(msgs.length).toBe 4
|
||||||
|
|
||||||
it "aggregates participants across all messages", ->
|
it "aggregates participants across all messages", ->
|
||||||
expect(@message_list._threadParticipants().length).toBe 4
|
expect(@message_list._threadParticipants().length).toBe 4
|
||||||
expect(@message_list._threadParticipants()[0] instanceof Contact).toBe true
|
expect(@message_list._threadParticipants()[0] instanceof Contact).toBe true
|
||||||
|
@ -227,13 +232,7 @@ describe "MessageList", ->
|
||||||
it "displays lists of participants on the page", ->
|
it "displays lists of participants on the page", ->
|
||||||
items = TestUtils.scryRenderedComponentsWithType(@message_list,
|
items = TestUtils.scryRenderedComponentsWithType(@message_list,
|
||||||
MessageParticipants)
|
MessageParticipants)
|
||||||
expect(items.length).toBe 5
|
expect(items.length).toBe 1
|
||||||
|
|
||||||
# We no longer do this (for now)
|
|
||||||
# it "displays the thread participants on the page", ->
|
|
||||||
# items = TestUtils.scryRenderedComponentsWithType(@message_list,
|
|
||||||
# ParticipantsItem)
|
|
||||||
# expect(items.length).toBe 1
|
|
||||||
|
|
||||||
it "focuses new composers when a draft is added", ->
|
it "focuses new composers when a draft is added", ->
|
||||||
spyOn(@message_list, "_focusDraft")
|
spyOn(@message_list, "_focusDraft")
|
||||||
|
|
|
@ -111,10 +111,7 @@ MessageStore = Reflux.createStore
|
||||||
atom.inbox.getCollection namespace.id, 'messages', {thread_id: @_threadId}
|
atom.inbox.getCollection namespace.id, 'messages', {thread_id: @_threadId}
|
||||||
loaded = false
|
loaded = false
|
||||||
|
|
||||||
# Expand all unread messages, all drafts, and the last message
|
@_expandItemsToDefault()
|
||||||
for item, idx in @_items
|
|
||||||
if item.unread or item.draft or idx is @_items.length - 1
|
|
||||||
@_itemsExpanded[item.id] = true
|
|
||||||
|
|
||||||
# Check that expanded messages have bodies. We won't mark ourselves
|
# Check that expanded messages have bodies. We won't mark ourselves
|
||||||
# as loaded until they're all available. Note that items can be manually
|
# as loaded until they're all available. Note that items can be manually
|
||||||
|
@ -139,6 +136,12 @@ MessageStore = Reflux.createStore
|
||||||
@_itemsLoading = false
|
@_itemsLoading = false
|
||||||
@trigger(@)
|
@trigger(@)
|
||||||
|
|
||||||
|
# Expand all unread messages, all drafts, and the last message
|
||||||
|
_expandItemsToDefault: ->
|
||||||
|
for item, idx in @_items
|
||||||
|
if item.unread or item.draft or idx is @_items.length - 1
|
||||||
|
@_itemsExpanded[item.id] = true
|
||||||
|
|
||||||
_fetchMessageIdFromAPI: (id) ->
|
_fetchMessageIdFromAPI: (id) ->
|
||||||
return if @_inflight[id]
|
return if @_inflight[id]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue