mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 21:57:55 +08:00
00c74cd1a9
Summary: There are now two objects, Folders & Labels. These inherit from `Category` (that's what Eben said they were using on the backend). There are two separate tasks. 1. MoveToFolderTask 2. ApplyLabelsTask It turns out that the semantics between the two are quite different. The reverse operation for moving to a folder is a bit tricky. As of 7-8-15, the Tasks are pretty much complete. I need to write tests for them still and do some manual testing in the client. Test Plan: Writing specs Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1724
36 lines
1.6 KiB
CoffeeScript
36 lines
1.6 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')
|
|
|
|
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)
|