From c59e2f24384b236dd9ea3b30966ace55f1b60d0d Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Mon, 28 Sep 2015 02:26:26 -0700 Subject: [PATCH] fix(message-store): Additional spec for double-focus, fix Menu warning --- spec-nylas/stores/message-store-spec.coffee | 8 ++++++++ src/components/menu.cjsx | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/spec-nylas/stores/message-store-spec.coffee b/spec-nylas/stores/message-store-spec.coffee index 9eef64e85..0c2fa722c 100644 --- a/spec-nylas/stores/message-store-spec.coffee +++ b/spec-nylas/stores/message-store-spec.coffee @@ -35,10 +35,18 @@ describe "MessageStore", -> it "should retrieve the focused thread", -> @focus = testThread + MessageStore._thread = null FocusedContentStore.trigger({impactsCollection: -> true}) expect(DatabaseStore.findAll).toHaveBeenCalled() expect(DatabaseStore.findAll.mostRecentCall.args[0]).toBe(Message) + describe "when the thread is already focused", -> + it "should do nothing", -> + @focus = testThread + MessageStore._thread = @focus + FocusedContentStore.trigger({impactsCollection: -> true}) + expect(DatabaseStore.findAll).not.toHaveBeenCalled() + describe "when the thread is unread", -> beforeEach -> @focus = null diff --git a/src/components/menu.cjsx b/src/components/menu.cjsx index c30c34c3d..0e76cbd70 100644 --- a/src/components/menu.cjsx +++ b/src/components/menu.cjsx @@ -22,20 +22,25 @@ class MenuItem extends React.Component - `checked` (optional) Pass a {Boolean} to specify whether the item is checked. ### @propTypes: - divider: React.PropTypes.string + divider: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.bool]) key: React.PropTypes.string selected: React.PropTypes.bool checked: React.PropTypes.bool render: => - if @props.divider? -
{@props.divider}
+ if @props.divider + dividerLabel = if _.isString(@props.divider) then @props.divider else '' +
+ {dividerLabel} +
else className = classNames "item": true "selected": @props.selected "checked": @props.checked -
{@props.content}
+
+ {@props.content} +
### Public: React component for a {Menu} item that displays a name and email address.