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
6be7d6be
Commit
6be7d6be
authored
Jan 10, 2022
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly pass instance in EDITOR_READY_EVENT
Changelog: fixed
parent
cce3194c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
app/assets/javascripts/editor/source_editor.js
app/assets/javascripts/editor/source_editor.js
+1
-1
spec/frontend/editor/source_editor_spec.js
spec/frontend/editor/source_editor_spec.js
+9
-6
No files found.
app/assets/javascripts/editor/source_editor.js
View file @
6be7d6be
...
...
@@ -149,7 +149,7 @@ export default class SourceEditor {
});
this
.
instances
.
push
(
instance
);
el
.
dispatchEvent
(
new
CustomEvent
(
EDITOR_READY_EVENT
,
{
instance
}));
el
.
dispatchEvent
(
new
CustomEvent
(
EDITOR_READY_EVENT
,
{
detail
:
{
instance
}
}));
return
instance
;
}
...
...
spec/frontend/editor/source_editor_spec.js
View file @
6be7d6be
...
...
@@ -342,27 +342,30 @@ describe('Base editor', () => {
describe
(
'
implementation
'
,
()
=>
{
let
instance
;
beforeEach
(()
=>
{
instance
=
editor
.
createInstance
({
el
:
editorEl
,
blobPath
,
blobContent
});
});
it
(
'
correctly proxies value from the model
'
,
()
=>
{
instance
=
editor
.
createInstance
({
el
:
editorEl
,
blobPath
,
blobContent
});
expect
(
instance
.
getValue
()).
toBe
(
blobContent
);
});
it
(
'
emits the EDITOR_READY_EVENT event
after setting up the instance
'
,
()
=>
{
it
(
'
emits the EDITOR_READY_EVENT event
passing the instance after setting it up
'
,
()
=>
{
jest
.
spyOn
(
monacoEditor
,
'
create
'
).
mockImplementation
(()
=>
{
return
{
setModel
:
jest
.
fn
(),
onDidDispose
:
jest
.
fn
(),
layout
:
jest
.
fn
(),
dispose
:
jest
.
fn
(),
};
});
const
eventSpy
=
jest
.
fn
();
let
passedInstance
;
const
eventSpy
=
jest
.
fn
().
mockImplementation
((
ev
)
=>
{
passedInstance
=
ev
.
detail
.
instance
;
});
editorEl
.
addEventListener
(
EDITOR_READY_EVENT
,
eventSpy
);
expect
(
eventSpy
).
not
.
toHaveBeenCalled
();
editor
.
createInstance
({
el
:
editorEl
});
instance
=
editor
.
createInstance
({
el
:
editorEl
});
expect
(
eventSpy
).
toHaveBeenCalled
();
expect
(
passedInstance
).
toBe
(
instance
);
});
});
...
...
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