mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user