fix(spec): Make specs work with new animated pending message

This commit is contained in:
Evan Morikawa 2015-08-05 09:34:56 -07:00
parent 9fe11bd655
commit c6c4403dfb
3 changed files with 13 additions and 31 deletions

View file

@ -1,25 +0,0 @@
React = require 'react'
{RetinaImg} = require 'nylas-component-kit'
MessageItem = require './message-item'
class PendingMessageItem extends MessageItem
@displayName = 'PendingMessageItem'
_renderMessageControls: -> null
_renderHeaderDetailToggle: -> null
_renderHeaderSideItems: ->
styles =
width: 24
float: "left"
marginTop: -2
marginRight: 10
<div style={styles}>
<RetinaImg ref="spinner"
name="sending-spinner.gif"
mode={RetinaImg.Mode.ContentPreserve}/>
</div>
module.exports = PendingMessageItem

View file

@ -10,11 +10,8 @@ class MessageItem extends React.Component
@displayName: "StubMessageItem"
render: -> <span></span>
class PendingMessageItem extends MessageItem
MessageItemContainer = proxyquire '../lib/message-item-container',
"./message-item": MessageItem
"./pending-message-item": PendingMessageItem
{InjectedComponent} = require 'nylas-component-kit'
@ -47,8 +44,9 @@ describe 'MessageItemContainer', ->
@isSendingDraft = true
doc = renderContainer(testDraft)
items = ReactTestUtils.scryRenderedComponentsWithType(doc,
PendingMessageItem)
MessageItem)
expect(items.length).toBe 1
expect(items[0].props.pending).toBe true
it "renders a message if it's not a draft", ->
@isSendingDraft = false

View file

@ -270,8 +270,17 @@ describe "MessageList", ->
MessageStore._items = [m5, m3, draftMessages[0]]
MessageStore._thread = test_thread
MessageStore.trigger()
cs = TestUtils.scryRenderedDOMComponentsWithClass(@messageList, "footer-reply-area")
expect(cs.length).toBe 0
cs = TestUtils.scryRenderedDOMComponentsWithClass(@messageList, "footer-reply-area-wrap")
expect(cs.length).toBe 1
expect(React.findDOMNode(cs[0]).style.height).toBe "0px"
it "shows the reply type if the last message isnt a draft", ->
MessageStore._items = [m5, m3]
MessageStore._thread = test_thread
MessageStore.trigger()
cs = TestUtils.scryRenderedDOMComponentsWithClass(@messageList, "footer-reply-area-wrap")
expect(cs.length).toBe 1
expect(parseInt(React.findDOMNode(cs[0]).style.height)).toBeGreaterThan 0
describe "reply behavior (_createReplyOrUpdateExistingDraft)", ->
beforeEach ->