mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-13 21:24:58 +08:00
0ef4911b22
# Conflicts: # internal_packages/feedback/lib/feedback-button.cjsx # internal_packages/thread-list/lib/thread-list.cjsx # src/flux/stores/draft-store.coffee
36 lines
1.8 KiB
CoffeeScript
36 lines
1.8 KiB
CoffeeScript
_ = require 'underscore'
|
|
Thread = require '../../src/flux/models/thread'
|
|
FocusedContentStore = require '../../src/flux/stores/focused-content-store'
|
|
Actions = require '../../src/flux/actions'
|
|
|
|
testThread = new Thread(id: '123', accountId: TEST_ACCOUNT_ID)
|
|
|
|
describe "FocusedContentStore", ->
|
|
describe "onSetFocus", ->
|
|
it "should not trigger if the thread is already focused", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
spyOn(FocusedContentStore, 'triggerAfterAnimationFrame')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.triggerAfterAnimationFrame).not.toHaveBeenCalled()
|
|
|
|
it "should not trigger if the focus is already null", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
spyOn(FocusedContentStore, 'triggerAfterAnimationFrame')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
expect(FocusedContentStore.triggerAfterAnimationFrame).not.toHaveBeenCalled()
|
|
|
|
it "should trigger otherwise", ->
|
|
FocusedContentStore._onFocus({collection: 'thread', item: null})
|
|
spyOn(FocusedContentStore, 'triggerAfterAnimationFrame')
|
|
FocusedContentStore._onFocus({collection: 'thread', item: testThread})
|
|
expect(FocusedContentStore.triggerAfterAnimationFrame).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)
|