mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-24 09:16:07 +08:00
606fb5839c
Summary: Resolves T1984 fixes T1984 closes T1984 Test Plan: Run two new test cases Reviewers: evan Reviewed By: evan Maniphest Tasks: T1984 Differential Revision: https://phab.nylas.com/D1654
38 lines
1.7 KiB
CoffeeScript
38 lines
1.7 KiB
CoffeeScript
_ = require 'underscore'
|
|
Thread = require '../../src/flux/models/thread'
|
|
FocusedContentStore = require '../../src/flux/stores/focused-content-store'
|
|
MarkThreadReadTask = require '../../src/flux/tasks/mark-thread-read'
|
|
Actions = require '../../src/flux/actions'
|
|
|
|
testThread = new Thread(id: '123')
|
|
|
|
describe "FocusedContentStore", ->
|
|
describe "onSetFocus", ->
|
|
it "should not trigger if the thread is already focused", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
spyOn(FocusedContentStore, 'trigger')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.trigger).not.toHaveBeenCalled()
|
|
|
|
it "should not trigger if the focus is already null", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
spyOn(FocusedContentStore, 'trigger')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
expect(FocusedContentStore.trigger).not.toHaveBeenCalled()
|
|
|
|
it "should trigger otherwise", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
spyOn(FocusedContentStore, 'trigger')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.trigger).toHaveBeenCalled()
|
|
|
|
describe "threadId", ->
|
|
it "should return the id of the focused thread", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.focusedId('thread')).toBe(testThread.id)
|
|
|
|
describe "thread", ->
|
|
it "should return the focused thread object", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.focused('thread')).toBe(testThread)
|