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
1da27551
Commit
1da27551
authored
Sep 16, 2020
by
derek-knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply 3rd round of feedback
parent
f048f4d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
app/assets/javascripts/static_site_editor/components/publish_toolbar.vue
...scripts/static_site_editor/components/publish_toolbar.vue
+2
-2
spec/frontend/static_site_editor/components/edit_area_spec.js
.../frontend/static_site_editor/components/edit_area_spec.js
+23
-6
spec/frontend/static_site_editor/components/edit_drawer_spec.js
...rontend/static_site_editor/components/edit_drawer_spec.js
+2
-1
No files found.
app/assets/javascripts/static_site_editor/components/publish_toolbar.vue
View file @
1da27551
...
...
@@ -41,7 +41,7 @@ export default {
:disabled=
"savingChanges"
@
click=
"$emit('editSettings')"
>
<span>
{{
__
(
'
Settings
'
)
}}
</span>
{{
__
(
'
Settings
'
)
}}
</gl-button>
<gl-button
ref=
"submit"
...
...
@@ -50,7 +50,7 @@ export default {
:loading=
"savingChanges"
@
click=
"$emit('submit')"
>
<span>
{{
__
(
'
Submit changes
'
)
}}
</span>
{{
__
(
'
Submit changes
'
)
}}
</gl-button>
</div>
</div>
...
...
spec/frontend/static_site_editor/components/edit_area_spec.js
View file @
1da27551
...
...
@@ -12,6 +12,7 @@ import UnsavedChangesConfirmDialog from '~/static_site_editor/components/unsaved
import
{
sourceContentTitle
as
title
,
sourceContentYAML
as
content
,
sourceContentHeaderObjYAML
as
headerSettings
,
sourceContentBody
as
body
,
returnUrl
,
}
from
'
../mock_data
'
;
...
...
@@ -170,25 +171,28 @@ describe('~/static_site_editor/components/edit_area.vue', () => {
});
it
(
'
closes the edit drawer
'
,
()
=>
{
buildWrapper
({
isDrawerOpen
:
true
});
findEditDrawer
().
vm
.
$emit
(
'
close
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
vm
.
isDrawerOpen
).
toBe
(
false
);
expect
(
findEditDrawer
().
props
(
'
isOpen
'
)).
toBe
(
false
);
});
});
it
(
'
forwards the matter settings
'
,
()
=>
{
expect
(
findEditDrawer
().
props
(
'
settings
'
)).
toBe
(
wrapper
.
vm
.
editableMatter
);
it
(
'
forwards the matter settings when the drawer is open
'
,
()
=>
{
findPublishToolbar
().
vm
.
$emit
(
'
editSettings
'
);
jest
.
spyOn
(
wrapper
.
vm
.
parsedSource
,
'
matter
'
).
mockReturnValueOnce
(
headerSettings
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findEditDrawer
().
props
(
'
settings
'
)).
toEqual
(
headerSettings
);
});
});
it
(
'
enables toolbar submit button
'
,
()
=>
{
expect
(
findPublishToolbar
().
props
(
'
hasSettings
'
)).
toBe
(
true
);
});
it
(
'
syncs matter changes
'
,
()
=>
{
it
(
'
syncs matter changes
regardless of edit mode
'
,
()
=>
{
const
newSettings
=
{
title
:
'
test
'
};
const
spySyncParsedSource
=
jest
.
spyOn
(
wrapper
.
vm
.
parsedSource
,
'
syncMatter
'
);
...
...
@@ -196,6 +200,18 @@ describe('~/static_site_editor/components/edit_area.vue', () => {
expect
(
spySyncParsedSource
).
toHaveBeenCalledWith
(
newSettings
);
});
it
(
'
syncs matter changes to content in markdown mode
'
,
()
=>
{
wrapper
.
setData
({
editorMode
:
EDITOR_TYPES
.
markdown
});
const
newSettings
=
{
title
:
'
test
'
};
findEditDrawer
().
vm
.
$emit
(
'
updateSettings
'
,
newSettings
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findRichContentEditor
().
props
(
'
content
'
)).
toContain
(
'
title: test
'
);
});
});
});
describe
(
'
when content lacks front matter
'
,
()
=>
{
...
...
@@ -221,6 +237,7 @@ describe('~/static_site_editor/components/edit_area.vue', () => {
findPublishToolbar
().
vm
.
$emit
(
'
submit
'
,
content
);
expect
(
wrapper
.
emitted
(
'
submit
'
)[
0
][
0
].
content
).
toBe
(
`
${
content
}
format-pass format-pass`
);
expect
(
wrapper
.
emitted
(
'
submit
'
).
length
).
toBe
(
1
);
});
});
});
spec/frontend/static_site_editor/components/edit_drawer_spec.js
View file @
1da27551
...
...
@@ -61,7 +61,8 @@ describe('~/static_site_editor/components/edit_drawer.vue', () => {
({
event
,
payload
,
finderFn
})
=>
{
finderFn
().
vm
.
$emit
(
event
,
payload
);
expect
(
wrapper
.
emitted
()[
event
][
0
][
0
]).
toBe
(
payload
);
expect
(
wrapper
.
emitted
(
event
)[
0
][
0
]).
toBe
(
payload
);
expect
(
wrapper
.
emitted
(
event
).
length
).
toBe
(
1
);
},
);
});
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