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
d9200f19
Commit
d9200f19
authored
Oct 19, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing the recursive update of the Editor Lite
parent
d8b20864
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
app/assets/javascripts/vue_shared/components/editor_lite.vue
app/assets/javascripts/vue_shared/components/editor_lite.vue
+3
-1
spec/frontend/vue_shared/components/editor_lite_spec.js
spec/frontend/vue_shared/components/editor_lite_spec.js
+24
-11
No files found.
app/assets/javascripts/vue_shared/components/editor_lite.vue
View file @
d9200f19
...
@@ -58,7 +58,9 @@ export default {
...
@@ -58,7 +58,9 @@ export default {
this
.
editor
.
updateModelLanguage
(
newVal
);
this
.
editor
.
updateModelLanguage
(
newVal
);
},
},
value
(
newVal
)
{
value
(
newVal
)
{
if
(
this
.
editor
.
getValue
()
!==
newVal
)
{
this
.
editor
.
setValue
(
newVal
);
this
.
editor
.
setValue
(
newVal
);
}
},
},
},
},
mounted
()
{
mounted
()
{
...
...
spec/frontend/vue_shared/components/editor_lite_spec.js
View file @
d9200f19
...
@@ -96,17 +96,6 @@ describe('Editor Lite component', () => {
...
@@ -96,17 +96,6 @@ describe('Editor Lite component', () => {
});
});
});
});
it
(
'
reacts to the changes in the pased value
'
,
async
()
=>
{
const
newValue
=
'
New Value
'
;
wrapper
.
setProps
({
value
:
newValue
,
});
await
nextTick
();
expect
(
setValue
).
toHaveBeenCalledWith
(
newValue
);
});
it
(
'
registers callback with editor onChangeContent
'
,
()
=>
{
it
(
'
registers callback with editor onChangeContent
'
,
()
=>
{
expect
(
onDidChangeModelContent
).
toHaveBeenCalledWith
(
expect
.
any
(
Function
));
expect
(
onDidChangeModelContent
).
toHaveBeenCalledWith
(
expect
.
any
(
Function
));
});
});
...
@@ -127,5 +116,29 @@ describe('Editor Lite component', () => {
...
@@ -127,5 +116,29 @@ describe('Editor Lite component', () => {
expect
(
wrapper
.
emitted
()[
'
editor-ready
'
]).
toBeDefined
();
expect
(
wrapper
.
emitted
()[
'
editor-ready
'
]).
toBeDefined
();
});
});
describe
(
'
reaction to the value update
'
,
()
=>
{
it
(
'
reacts to the changes in the passed value
'
,
async
()
=>
{
const
newValue
=
'
New Value
'
;
wrapper
.
setProps
({
value
:
newValue
,
});
await
nextTick
();
expect
(
setValue
).
toHaveBeenCalledWith
(
newValue
);
});
it
(
"
does not update value if the passed one is exactly the same as the editor's content
"
,
async
()
=>
{
const
newValue
=
`
${
value
}
`
;
// to make sure we're creating a new String with the same content and not just a reference
wrapper
.
setProps
({
value
:
newValue
,
});
await
nextTick
();
expect
(
setValue
).
not
.
toHaveBeenCalled
();
});
});
});
});
});
});
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