mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Update markdown preview when markdown buffer is saved
This commit is contained in:
committed by
probablycorey
parent
9a6b5986fe
commit
5c93fd4574
@@ -13,6 +13,8 @@ module.exports =
|
||||
console.warn("Can not render markdown for #{item.getUri()}")
|
||||
return
|
||||
|
||||
activePane.on 'core:save', => @show()
|
||||
|
||||
editSession = item
|
||||
if nextPane = activePane.getNextPane()
|
||||
if preview = nextPane.itemForUri("markdown-preview:#{editSession.getPath()}")
|
||||
|
||||
@@ -65,3 +65,15 @@ describe "MarkdownPreview package", ->
|
||||
expect(pane2.getItems()).toHaveLength 2
|
||||
expect(pane2.activeItem).toBe preview
|
||||
expect(pane1).toMatchSelector(':has(:focus)')
|
||||
|
||||
describe "when a buffer is modified and saved after a preview item has already been created", ->
|
||||
it "updates the existing preview item", ->
|
||||
rootView.getActiveView().trigger 'markdown-preview:show'
|
||||
[pane1, pane2] = rootView.getPanes()
|
||||
preview = pane2.activeItem
|
||||
pane1.focus()
|
||||
|
||||
preview.fetchRenderedMarkdown.reset()
|
||||
pane1.saveActiveItem = () ->
|
||||
pane1.trigger("core:save")
|
||||
expect(preview.fetchRenderedMarkdown).toHaveBeenCalled()
|
||||
Reference in New Issue
Block a user