From c6c4403dfbed962dfaac9a9059bcc8f0d84917e1 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Wed, 5 Aug 2015 09:34:56 -0700 Subject: [PATCH] fix(spec): Make specs work with new animated pending message --- .../lib/pending-message-item.cjsx | 25 ------------------- .../spec/message-item-container-spec.cjsx | 6 ++--- .../message-list/spec/message-list-spec.cjsx | 13 ++++++++-- 3 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 internal_packages/message-list/lib/pending-message-item.cjsx diff --git a/internal_packages/message-list/lib/pending-message-item.cjsx b/internal_packages/message-list/lib/pending-message-item.cjsx deleted file mode 100644 index 085d85514..000000000 --- a/internal_packages/message-list/lib/pending-message-item.cjsx +++ /dev/null @@ -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 - -
- -
- -module.exports = PendingMessageItem diff --git a/internal_packages/message-list/spec/message-item-container-spec.cjsx b/internal_packages/message-list/spec/message-item-container-spec.cjsx index ff23b62cb..c1d9782bd 100644 --- a/internal_packages/message-list/spec/message-item-container-spec.cjsx +++ b/internal_packages/message-list/spec/message-item-container-spec.cjsx @@ -10,11 +10,8 @@ class MessageItem extends React.Component @displayName: "StubMessageItem" render: -> -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 diff --git a/internal_packages/message-list/spec/message-list-spec.cjsx b/internal_packages/message-list/spec/message-list-spec.cjsx index d9b5152fc..86e02d031 100644 --- a/internal_packages/message-list/spec/message-list-spec.cjsx +++ b/internal_packages/message-list/spec/message-list-spec.cjsx @@ -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 ->