Skip to content

Commit

Permalink
🐛 Fix error raised when editor is destroyed during animation
Browse files Browse the repository at this point in the history
Fixes #438
  • Loading branch information
abe33 committed Dec 21, 2015
1 parent 4cd3cad commit cb215b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/minimap-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,8 @@ export default class MinimapElement {
}

let update = () => {
if (!this.minimap) { return }

let passed = this.getTime() - start
if (duration === 0) {
progress = 1
Expand Down
8 changes: 8 additions & 0 deletions spec/minimap-element-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,14 @@ describe('MinimapElement', () => {
return editorElement.getScrollTop() >= 380
})
})

it('stops the animation if the text editor is destroyed', () => {
editor.destroy()

nextAnimationFrame !== noAnimationFrame && nextAnimationFrame()

expect(nextAnimationFrame === noAnimationFrame)
})
})

describe('dragging the visible area', () => {
Expand Down

0 comments on commit cb215b6

Please sign in to comment.