Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a677fbaf
Commit
a677fbaf
authored
Mar 08, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed up editor spec by catching any thrown errors
parent
e64b93cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
ee/app/assets/javascripts/ide/lib/editor.js
ee/app/assets/javascripts/ide/lib/editor.js
+12
-4
spec/javascripts/ide/lib/editor_spec.js
spec/javascripts/ide/lib/editor_spec.js
+15
-17
No files found.
ee/app/assets/javascripts/ide/lib/editor.js
View file @
a677fbaf
...
@@ -121,12 +121,20 @@ export default class Editor {
...
@@ -121,12 +121,20 @@ export default class Editor {
}
}
dispose
()
{
dispose
()
{
this
.
disposable
.
dispose
();
window
.
removeEventListener
(
'
resize
'
,
this
.
debouncedUpdate
);
window
.
removeEventListener
(
'
resize
'
,
this
.
debouncedUpdate
);
// dispose main monaco instance
try
{
if
(
this
.
instance
)
{
this
.
disposable
.
dispose
();
this
.
instance
=
null
;
// dispose main monaco instance
if
(
this
.
instance
)
{
this
.
instance
=
null
;
}
}
catch
(
e
)
{
// dispose main monaco instance
if
(
this
.
instance
)
{
this
.
instance
=
null
;
}
}
}
}
}
...
...
spec/javascripts/ide/lib/editor_spec.js
View file @
a677fbaf
...
@@ -5,8 +5,16 @@ import { file } from '../helpers';
...
@@ -5,8 +5,16 @@ import { file } from '../helpers';
describe
(
'
Multi-file editor library
'
,
()
=>
{
describe
(
'
Multi-file editor library
'
,
()
=>
{
let
instance
;
let
instance
;
let
el
;
let
holder
;
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
el
=
document
.
createElement
(
'
div
'
);
holder
=
document
.
createElement
(
'
div
'
);
el
.
appendChild
(
holder
);
document
.
body
.
appendChild
(
el
);
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
instance
=
editor
.
create
(
monaco
);
instance
=
editor
.
create
(
monaco
);
...
@@ -16,6 +24,8 @@ describe('Multi-file editor library', () => {
...
@@ -16,6 +24,8 @@ describe('Multi-file editor library', () => {
afterEach
(()
=>
{
afterEach
(()
=>
{
instance
.
dispose
();
instance
.
dispose
();
el
.
remove
();
});
});
it
(
'
creates instance of editor
'
,
()
=>
{
it
(
'
creates instance of editor
'
,
()
=>
{
...
@@ -27,46 +37,34 @@ describe('Multi-file editor library', () => {
...
@@ -27,46 +37,34 @@ describe('Multi-file editor library', () => {
});
});
describe
(
'
createInstance
'
,
()
=>
{
describe
(
'
createInstance
'
,
()
=>
{
let
el
;
beforeEach
(()
=>
{
el
=
document
.
createElement
(
'
div
'
);
});
it
(
'
creates editor instance
'
,
()
=>
{
it
(
'
creates editor instance
'
,
()
=>
{
spyOn
(
instance
.
monaco
.
editor
,
'
create
'
).
and
.
callThrough
();
spyOn
(
instance
.
monaco
.
editor
,
'
create
'
).
and
.
callThrough
();
instance
.
createInstance
(
el
);
instance
.
createInstance
(
holder
);
expect
(
instance
.
monaco
.
editor
.
create
).
toHaveBeenCalled
();
expect
(
instance
.
monaco
.
editor
.
create
).
toHaveBeenCalled
();
});
});
it
(
'
creates dirty diff controller
'
,
()
=>
{
it
(
'
creates dirty diff controller
'
,
()
=>
{
instance
.
createInstance
(
el
);
instance
.
createInstance
(
holder
);
expect
(
instance
.
dirtyDiffController
).
not
.
toBeNull
();
expect
(
instance
.
dirtyDiffController
).
not
.
toBeNull
();
});
});
it
(
'
creates model manager
'
,
()
=>
{
it
(
'
creates model manager
'
,
()
=>
{
instance
.
createInstance
(
el
);
instance
.
createInstance
(
holder
);
expect
(
instance
.
modelManager
).
not
.
toBeNull
();
expect
(
instance
.
modelManager
).
not
.
toBeNull
();
});
});
});
});
describe
(
'
createDiffInstance
'
,
()
=>
{
describe
(
'
createDiffInstance
'
,
()
=>
{
let
el
;
beforeEach
(()
=>
{
el
=
document
.
createElement
(
'
div
'
);
});
it
(
'
creates editor instance
'
,
()
=>
{
it
(
'
creates editor instance
'
,
()
=>
{
spyOn
(
instance
.
monaco
.
editor
,
'
createDiffEditor
'
).
and
.
callThrough
();
spyOn
(
instance
.
monaco
.
editor
,
'
createDiffEditor
'
).
and
.
callThrough
();
instance
.
createDiffInstance
(
el
);
instance
.
createDiffInstance
(
holder
);
expect
(
instance
.
monaco
.
editor
.
createDiffEditor
).
toHaveBeenCalledWith
(
el
,
{
expect
(
instance
.
monaco
.
editor
.
createDiffEditor
).
toHaveBeenCalledWith
(
holder
,
{
readOnly
:
true
,
readOnly
:
true
,
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment