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
8710212e
Commit
8710212e
authored
Jan 13, 2022
by
Mireya Andres
Committed by
Frédéric Caplette
Jan 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix schema registration in the pipeline editor
Changelog: fixed
parent
f3a1cbfc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
27 deletions
+25
-27
app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue
...scripts/pipeline_editor/components/editor/text_editor.vue
+4
-6
app/assets/javascripts/vue_shared/components/source_editor.vue
...ssets/javascripts/vue_shared/components/source_editor.vue
+1
-1
spec/frontend/pipeline_editor/components/editor/text_editor_spec.js
...end/pipeline_editor/components/editor/text_editor_spec.js
+20
-20
No files found.
app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue
View file @
8710212e
...
...
@@ -15,12 +15,10 @@ export default {
onCiConfigUpdate
(
content
)
{
this
.
$emit
(
'
updateCiConfig
'
,
content
);
},
registerCiSchema
()
{
registerCiSchema
(
{
detail
:
{
instance
}
}
)
{
if
(
this
.
glFeatures
.
schemaLinting
)
{
const
editorInstance
=
this
.
$refs
.
editor
.
getEditor
();
editorInstance
.
use
({
definition
:
CiSchemaExtension
});
editorInstance
.
registerCiSchema
();
instance
.
use
({
definition
:
CiSchemaExtension
});
instance
.
registerCiSchema
();
}
},
},
...
...
@@ -33,7 +31,7 @@ export default {
ref=
"editor"
:file-name=
"ciConfigPath"
v-bind=
"$attrs"
@[$
options.readyEvent]=
"registerCiSchema"
@[$
options.readyEvent]=
"registerCiSchema
($event)
"
@
input=
"onCiConfigUpdate"
v-on=
"$listeners"
/>
...
...
app/assets/javascripts/vue_shared/components/source_editor.vue
View file @
8710212e
...
...
@@ -97,7 +97,7 @@ export default {
ref="editor"
data-editor-loading
data-qa-selector="source_editor_container"
@[$options.readyEvent]="$emit($options.readyEvent)"
@[$options.readyEvent]="$emit($options.readyEvent
, $event
)"
>
<pre
class=
"editor-loading-content"
>
{{
value
}}
</pre>
</div>
...
...
spec/frontend/pipeline_editor/components/editor/text_editor_spec.js
View file @
8710212e
...
...
@@ -17,19 +17,12 @@ describe('Pipeline Editor | Text editor component', () => {
let
editorReadyListener
;
let
mockUse
;
let
mockRegisterCiSchema
;
let
mockEditorInstance
;
let
editorInstanceDetail
;
const
MockSourceEditor
=
{
template
:
'
<div/>
'
,
props
:
[
'
value
'
,
'
fileName
'
],
mounted
()
{
this
.
$emit
(
EDITOR_READY_EVENT
);
},
methods
:
{
getEditor
:
()
=>
({
use
:
mockUse
,
registerCiSchema
:
mockRegisterCiSchema
,
}),
},
};
const
createComponent
=
(
glFeatures
=
{},
mountFn
=
shallowMount
)
=>
{
...
...
@@ -58,6 +51,21 @@ describe('Pipeline Editor | Text editor component', () => {
const
findEditor
=
()
=>
wrapper
.
findComponent
(
MockSourceEditor
);
beforeEach
(()
=>
{
editorReadyListener
=
jest
.
fn
();
mockUse
=
jest
.
fn
();
mockRegisterCiSchema
=
jest
.
fn
();
mockEditorInstance
=
{
use
:
mockUse
,
registerCiSchema
:
mockRegisterCiSchema
,
};
editorInstanceDetail
=
{
detail
:
{
instance
:
mockEditorInstance
,
},
};
});
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
@@ -67,10 +75,6 @@ describe('Pipeline Editor | Text editor component', () => {
describe
(
'
template
'
,
()
=>
{
beforeEach
(()
=>
{
editorReadyListener
=
jest
.
fn
();
mockUse
=
jest
.
fn
();
mockRegisterCiSchema
=
jest
.
fn
();
createComponent
();
});
...
...
@@ -87,7 +91,7 @@ describe('Pipeline Editor | Text editor component', () => {
});
it
(
'
bubbles up events
'
,
()
=>
{
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
);
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
,
editorInstanceDetail
);
expect
(
editorReadyListener
).
toHaveBeenCalled
();
});
...
...
@@ -97,11 +101,7 @@ describe('Pipeline Editor | Text editor component', () => {
describe
(
'
when `schema_linting` feature flag is on
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
schemaLinting
:
true
});
// Since the editor will have already mounted, the event will have fired.
// To ensure we properly test this, we clear the mock and re-remit the event.
mockRegisterCiSchema
.
mockClear
();
mockUse
.
mockClear
();
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
);
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
,
editorInstanceDetail
);
});
it
(
'
configures editor with syntax highlight
'
,
()
=>
{
...
...
@@ -113,7 +113,7 @@ describe('Pipeline Editor | Text editor component', () => {
describe
(
'
when `schema_linting` feature flag is off
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
);
findEditor
().
vm
.
$emit
(
EDITOR_READY_EVENT
,
editorInstanceDetail
);
});
it
(
'
does not call the register CI schema function
'
,
()
=>
{
...
...
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