Mailspring/internal_packages/message-list/spec/message-toolbar-items-spec.cjsx
Evan Morikawa dc5941f3f1 feat(archive): archive now pops back to thread list
Summary:
add spec for message toolbar items

add thread list spec

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1344
2015-03-25 14:17:57 -04:00

27 lines
1.2 KiB
CoffeeScript

React = require 'react/addons'
ReactTestUtils = React.addons.TestUtils
MessageToolbarItems = require "../lib/message-toolbar-items.cjsx"
{WorkspaceStore, Actions} = require 'inbox-exports'
describe "MessageToolbarItems", ->
beforeEach ->
@toolbarItems = ReactTestUtils.renderIntoDocument(<MessageToolbarItems />)
@archiveButton = @toolbarItems.refs["archiveButton"]
spyOn(Actions, "archiveAndNext")
spyOn(Actions, "archiveCurrentThread")
it "renders the archive button", ->
btns = ReactTestUtils.scryRenderedDOMComponentsWithClass(@toolbarItems, "btn-archive")
expect(btns.length).toBe 1
it "archives and next in split mode", ->
spyOn(WorkspaceStore, "selectedLayoutMode").andReturn "split"
ReactTestUtils.Simulate.click(@archiveButton.getDOMNode())
expect(Actions.archiveCurrentThread).not.toHaveBeenCalled()
expect(Actions.archiveAndNext).toHaveBeenCalled()
it "archives in list mode", ->
spyOn(WorkspaceStore, "selectedLayoutMode").andReturn "list"
ReactTestUtils.Simulate.click(@archiveButton.getDOMNode())
expect(Actions.archiveCurrentThread).toHaveBeenCalled()
expect(Actions.archiveAndNext).not.toHaveBeenCalled()