mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-11 23:24:32 +08:00
fix(specs): Update specs following 0.29.2 > 0.34.3 move
This commit is contained in:
parent
51602f69a5
commit
a5013c0bbd
5 changed files with 22 additions and 7 deletions
|
@ -130,8 +130,8 @@ makeComposer = ->
|
||||||
|
|
||||||
describe "populated composer", ->
|
describe "populated composer", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@isSending = {state: false}
|
@isSending = false
|
||||||
spyOn(DraftStore, "isSendingDraft").andCallFake => @isSending.state
|
spyOn(DraftStore, "isSendingDraft").andCallFake => @isSending
|
||||||
|
|
||||||
afterEach ->
|
afterEach ->
|
||||||
DraftStore._cleanupAllSessions()
|
DraftStore._cleanupAllSessions()
|
||||||
|
@ -524,7 +524,7 @@ describe "populated composer", ->
|
||||||
useFullDraft.apply(@); makeComposer.call(@)
|
useFullDraft.apply(@); makeComposer.call(@)
|
||||||
sendBtn = React.findDOMNode(@composer.refs.sendButton)
|
sendBtn = React.findDOMNode(@composer.refs.sendButton)
|
||||||
ReactTestUtils.Simulate.click sendBtn
|
ReactTestUtils.Simulate.click sendBtn
|
||||||
@isSending.state = true
|
@isSending = true
|
||||||
DraftStore.trigger()
|
DraftStore.trigger()
|
||||||
ReactTestUtils.Simulate.click sendBtn
|
ReactTestUtils.Simulate.click sendBtn
|
||||||
expect(Actions.sendDraft).toHaveBeenCalledWith(DRAFT_CLIENT_ID)
|
expect(Actions.sendDraft).toHaveBeenCalledWith(DRAFT_CLIENT_ID)
|
||||||
|
@ -537,17 +537,20 @@ describe "populated composer", ->
|
||||||
NylasTestUtils.loadKeymap("internal_packages/composer/keymaps/composer")
|
NylasTestUtils.loadKeymap("internal_packages/composer/keymaps/composer")
|
||||||
@$composer = @composer.refs.composerWrap
|
@$composer = @composer.refs.composerWrap
|
||||||
|
|
||||||
it "sends the draft on cmd-enter", ->
|
fit "sends the draft on cmd-enter", ->
|
||||||
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
||||||
expect(Actions.sendDraft).toHaveBeenCalled()
|
expect(Actions.sendDraft).toHaveBeenCalled()
|
||||||
|
expect(Actions.sendDraft.calls.length).toBe 1
|
||||||
|
|
||||||
it "does not send the draft on enter if the button isn't in focus", ->
|
it "does not send the draft on enter if the button isn't in focus", ->
|
||||||
NylasTestUtils.keyPress("enter", React.findDOMNode(@$composer))
|
NylasTestUtils.keyPress("enter", React.findDOMNode(@$composer))
|
||||||
expect(Actions.sendDraft).not.toHaveBeenCalled()
|
expect(Actions.sendDraft).not.toHaveBeenCalled()
|
||||||
|
|
||||||
it "doesn't let you send twice", ->
|
fit "doesn't let you send twice", ->
|
||||||
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
||||||
@isSending.state = true
|
expect(Actions.sendDraft).toHaveBeenCalled()
|
||||||
|
expect(Actions.sendDraft.calls.length).toBe 1
|
||||||
|
@isSending = true
|
||||||
DraftStore.trigger()
|
DraftStore.trigger()
|
||||||
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
NylasTestUtils.keyPress("cmd-enter", React.findDOMNode(@$composer))
|
||||||
expect(Actions.sendDraft).toHaveBeenCalled()
|
expect(Actions.sendDraft).toHaveBeenCalled()
|
||||||
|
|
|
@ -86,6 +86,7 @@ describe 'ModuleCache', ->
|
||||||
exports.load = function() { require('underscore'); };
|
exports.load = function() { require('underscore'); };
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
spyOn(process, 'cwd').andReturn('/') # Required when running this test from CLI
|
||||||
packageMain = require(indexPath)
|
packageMain = require(indexPath)
|
||||||
Module._findPath.reset()
|
Module._findPath.reset()
|
||||||
expect(-> packageMain.load()).toThrow()
|
expect(-> packageMain.load()).toThrow()
|
||||||
|
|
|
@ -3,7 +3,7 @@ describe '"nylas" protocol URL', ->
|
||||||
called = false
|
called = false
|
||||||
request = new XMLHttpRequest()
|
request = new XMLHttpRequest()
|
||||||
request.addEventListener('load', -> called = true)
|
request.addEventListener('load', -> called = true)
|
||||||
request.open('GET', 'nylas://async/package.json', true)
|
request.open('GET', 'nylas://account-sidebar/package.json', true)
|
||||||
request.send()
|
request.send()
|
||||||
|
|
||||||
waitsFor 'request to be done', -> called is true
|
waitsFor 'request to be done', -> called is true
|
||||||
|
|
|
@ -13,6 +13,16 @@ NylasTestUtils =
|
||||||
NylasEnv.keymaps.loadKeymap(keymapPath)
|
NylasEnv.keymaps.loadKeymap(keymapPath)
|
||||||
|
|
||||||
keyPress: (key, target) ->
|
keyPress: (key, target) ->
|
||||||
|
# React's "renderIntoDocument" does not /actually/ attach the component
|
||||||
|
# to the document. It's a sham: http://dragon.ak.fbcdn.net/hphotos-ak-xpf1/t39.3284-6/10956909_1423563877937976_838415501_n.js
|
||||||
|
# The Atom keymap manager doesn't work correctly on elements outside of the
|
||||||
|
# DOM tree, so we need to attach it.
|
||||||
|
unless document.contains(target)
|
||||||
|
parent = target
|
||||||
|
while parent.parentNode?
|
||||||
|
parent = parent.parentNode
|
||||||
|
document.documentElement.appendChild(parent)
|
||||||
|
|
||||||
event = KeymapManager.buildKeydownEvent(key, target: target)
|
event = KeymapManager.buildKeydownEvent(key, target: target)
|
||||||
NylasEnv.keymaps.handleKeyboardEvent(event)
|
NylasEnv.keymaps.handleKeyboardEvent(event)
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ class KeyCommandsRegion extends React.Component
|
||||||
|
|
||||||
componentWillUnmount: ->
|
componentWillUnmount: ->
|
||||||
@_unmountListeners()
|
@_unmountListeners()
|
||||||
|
@_mounted = false
|
||||||
|
|
||||||
# When the {KeymapManager} finds a valid keymap in a `.cson` file, it
|
# When the {KeymapManager} finds a valid keymap in a `.cson` file, it
|
||||||
# will create a CustomEvent with the command name as its type. That
|
# will create a CustomEvent with the command name as its type. That
|
||||||
|
|
Loading…
Add table
Reference in a new issue