Destroy editors after text editor component specs

This only now became necessary because TokenizedBuffer now *always*
receives a reference to the Atom config on construction, and always
tries to read from it when isFoldableAtRow is called, which can happen
after test cleanup due to resize observers.
This commit is contained in:
Max Brunsfeld
2017-11-20 11:59:21 -08:00
parent 503d239bc3
commit 20bf705000

View File

@@ -25,6 +25,8 @@ document.registerElement('text-editor-component-test-element', {
})
})
const editors = []
describe('TextEditorComponent', () => {
beforeEach(() => {
jasmine.useRealClock()
@@ -35,6 +37,13 @@ describe('TextEditorComponent', () => {
jasmine.attachToDOM(scrollbarStyle)
})
afterEach(() => {
for (const editor of editors) {
editor.destroy()
}
editors.length = 0
})
describe('rendering', () => {
it('renders lines and line numbers for the visible region', async () => {
const {component, element, editor} = buildComponent({rowsPerTile: 3, autoHeight: false})
@@ -4486,6 +4495,7 @@ function buildEditor (params = {}) {
const editor = new TextEditor(editorParams)
editor.testAutoscrollRequests = []
editor.onDidRequestAutoscroll((request) => { editor.testAutoscrollRequests.push(request) })
editors.push(editor)
return editor
}