fix(specs/keys): Fix broken specs, clean up CJSX

This commit is contained in:
Ben Gotow 2015-08-06 12:22:06 -07:00
parent d0b7f2b0dd
commit 85fdf43995
7 changed files with 25 additions and 31 deletions

View file

@ -28,6 +28,7 @@ class AttachmentComponent extends React.Component
<Flexbox direction="row" style={alignItems: 'center'}>
<RetinaImg className="file-icon"
fallback="file-fallback.png"
mode={RetinaImg.Mode.ContentPreserve}
name="file-#{@props.file.displayExtension()}.png"/>
<span className="file-name">{@props.file.displayName()}</span>
{@_renderFileActions()}
@ -58,10 +59,10 @@ class AttachmentComponent extends React.Component
_isDownloading: => @props.download?.state is "downloading"
_renderRemoveIcon: ->
<RetinaImg name="remove-attachment.png"/>
<RetinaImg name="remove-attachment.png" mode={RetinaImg.Mode.ContentPreserve} />
_renderDownloadButton: ->
<RetinaImg name="icon-attachment-download.png"/>
<RetinaImg name="icon-attachment-download.png" mode={RetinaImg.Mode.ContentPreserve} />
_onDragStart: (event) =>
path = FileDownloadStore.pathForFile(@props.file)

View file

@ -84,7 +84,7 @@ DeveloperBarStore = Reflux.createStore
data = "-d '#{postBody}'" unless request.method == 'GET'
item =
id: curlItemId
id: "curlitemId:#{curlItemId}"
command: "curl -X #{request.method} #{data} #{url}"
statusCode: response?.statusCode || 0

View file

@ -270,17 +270,8 @@ describe "MessageList", ->
MessageStore._items = [m5, m3, draftMessages[0]]
MessageStore._thread = test_thread
MessageStore.trigger()
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
cs = TestUtils.scryRenderedDOMComponentsWithClass(@messageList, "footer-reply-area")
expect(cs.length).toBe 0
describe "reply behavior (_createReplyOrUpdateExistingDraft)", ->
beforeEach ->

View file

@ -65,13 +65,13 @@ class ActivitySidebar extends React.Component
if incomplete is 0
return []
else if error
<div className="item">
<div className="item" key="initial-sync">
<div className="inner">Initial sync encountered an error. Waiting to retry...
<div className="btn btn-emphasis" onClick={@_onTryAgain}>Try Again</div>
</div>
</div>
else
<div className="item">
<div className="item" key="initial-sync">
<div className="progress-track">
<div className="progress" style={width: "#{progress}%"}></div>
</div>

View file

@ -108,7 +108,7 @@ class SidebarInternal extends React.Component
value = "True" if value is true
value = "False" if value is false
value = moment.unix(value).format("DD / MM / YYYY h:mm a z") if key.indexOf("_time") > 0
cjsx.push <div style={textAlign:'right'}><span style={float:'left'}>{displayName}:</span>{value}</div>
cjsx.push <div style={textAlign:'right'} key={key}><span style={float:'left'}>{displayName}:</span>{value}</div>
cjsx
_appUrl: (app) =>

View file

@ -76,9 +76,6 @@
font-size: @font-size-small;
text-overflow: ellipsis;
overflow: hidden;
.unread-true {
font-weight: @font-weight-semi-bold;
}
position: relative;
top:2px;
}
@ -133,6 +130,11 @@
.list-column {
border-bottom: 1px solid @list-border;
}
.participants {
.unread-true {
font-weight: @font-weight-semi-bold;
}
}
}
.unread:not(.focused) {

View file

@ -463,20 +463,20 @@ describe "DraftStore", ->
describe "onDestroyDraft", ->
beforeEach ->
@draftReset = jasmine.createSpy('draft reset')
@draftSessionTeardown = jasmine.createSpy('draft teardown')
@session =
draft: ->
pristine: false
changes:
commit: -> Promise.resolve()
reset: @draftReset
cleanup: ->
teardown: ->
teardown: @draftSessionTeardown
DraftStore._draftSessions = {"abc": @session}
spyOn(Actions, 'queueTask')
it "should reset the draft session, ensuring no more saves are made", ->
it "should teardown the draft session, ensuring no more saves are made", ->
DraftStore._onDestroyDraft('abc')
expect(@draftReset).toHaveBeenCalled()
expect(@draftSessionTeardown).toHaveBeenCalled()
it "should not throw if the draft session is not in the window", ->
expect ->
@ -565,7 +565,7 @@ describe "DraftStore", ->
DraftStore._draftSessions = {}
proxy =
prepare: -> Promise.resolve(proxy)
cleanup: ->
teardown: ->
draft: -> {}
changes:
commit: -> Promise.resolve()
@ -638,9 +638,9 @@ describe "DraftStore", ->
task = Actions.queueTask.calls[0].args[0]
expect(task.fromPopout).toBe true
describe "session cleanup", ->
describe "session teardown", ->
beforeEach ->
@draftCleanup = jasmine.createSpy('draft cleanup')
@draftTeardown = jasmine.createSpy('draft teardown')
@session =
draftLocalId: "abc"
draft: ->
@ -648,15 +648,15 @@ describe "DraftStore", ->
changes:
commit: -> Promise.resolve()
reset: ->
cleanup: @draftCleanup
teardown: @draftTeardown
DraftStore._draftSessions = {"abc": @session}
DraftStore._doneWithSession(@session)
it "removes from the list of draftSessions", ->
expect(DraftStore._draftSessions["abc"]).toBeUndefined()
it "Calls cleanup on the session", ->
expect(@draftCleanup).toHaveBeenCalled
it "Calls teardown on the session", ->
expect(@draftTeardown).toHaveBeenCalled
describe "mailto handling", ->
describe "extensions", ->