Commit dcbfa848 authored by Phil Hughes's avatar Phil Hughes

dispose models before setup

parent 581d486a
...@@ -34,7 +34,6 @@ describe('RepoEditor', () => { ...@@ -34,7 +34,6 @@ describe('RepoEditor', () => {
resetStore(vm.$store); resetStore(vm.$store);
Editor.editorInstance.dirtyDiffController.dispose();
Editor.editorInstance.modelManager.dispose(); Editor.editorInstance.modelManager.dispose();
}); });
...@@ -66,6 +65,8 @@ describe('RepoEditor', () => { ...@@ -66,6 +65,8 @@ describe('RepoEditor', () => {
it('creates new model', () => { it('creates new model', () => {
spyOn(vm.editor, 'createModel').and.callThrough(); spyOn(vm.editor, 'createModel').and.callThrough();
Editor.editorInstance.modelManager.dispose();
vm.setupEditor(); vm.setupEditor();
expect(vm.editor.createModel).toHaveBeenCalledWith(vm.$store.getters.activeFile); expect(vm.editor.createModel).toHaveBeenCalledWith(vm.$store.getters.activeFile);
...@@ -75,6 +76,8 @@ describe('RepoEditor', () => { ...@@ -75,6 +76,8 @@ describe('RepoEditor', () => {
it('attaches model to editor', () => { it('attaches model to editor', () => {
spyOn(vm.editor, 'attachModel').and.callThrough(); spyOn(vm.editor, 'attachModel').and.callThrough();
Editor.editorInstance.modelManager.dispose();
vm.setupEditor(); vm.setupEditor();
expect(vm.editor.attachModel).toHaveBeenCalledWith(vm.model); expect(vm.editor.attachModel).toHaveBeenCalledWith(vm.model);
...@@ -83,6 +86,8 @@ describe('RepoEditor', () => { ...@@ -83,6 +86,8 @@ describe('RepoEditor', () => {
it('adds callback methods', () => { it('adds callback methods', () => {
spyOn(vm.editor, 'onPositionChange').and.callThrough(); spyOn(vm.editor, 'onPositionChange').and.callThrough();
Editor.editorInstance.modelManager.dispose();
vm.setupEditor(); vm.setupEditor();
expect(vm.editor.onPositionChange).toHaveBeenCalled(); expect(vm.editor.onPositionChange).toHaveBeenCalled();
...@@ -90,8 +95,6 @@ describe('RepoEditor', () => { ...@@ -90,8 +95,6 @@ describe('RepoEditor', () => {
}); });
it('updates state when model content changed', (done) => { it('updates state when model content changed', (done) => {
vm.setupEditor();
vm.model.setValue('testing 123'); vm.model.setValue('testing 123');
setTimeout(() => { setTimeout(() => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment