fix(message-store): Additional spec for double-focus, fix Menu warning

This commit is contained in:
Ben Gotow 2015-09-28 02:26:26 -07:00
parent f2418be462
commit c59e2f2438
2 changed files with 17 additions and 4 deletions

View file

@ -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

View file

@ -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?
<div className="item divider">{@props.divider}</div>
if @props.divider
dividerLabel = if _.isString(@props.divider) then @props.divider else ''
<div className="item divider">
{dividerLabel}
</div>
else
className = classNames
"item": true
"selected": @props.selected
"checked": @props.checked
<div className={className} key={@props.key} onMouseDown={@props.onMouseDown}>{@props.content}</div>
<div className={className} key={@props.key} onMouseDown={@props.onMouseDown}>
{@props.content}
</div>
###
Public: React component for a {Menu} item that displays a name and email address.