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
e8e492d0
Commit
e8e492d0
authored
Jun 11, 2021
by
Himanshu Kapoor
Committed by
Himanshu Kapoor
Jun 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not trim wiki content by default
Changelog: fixed
parent
59d04e93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue
...s/javascripts/pages/shared/wikis/components/wiki_form.vue
+4
-4
spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
.../frontend/pages/shared/wikis/components/wiki_form_spec.js
+15
-5
No files found.
app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue
View file @
e8e492d0
...
...
@@ -119,7 +119,7 @@ export default {
return
{
title
:
this
.
pageInfo
.
title
?.
trim
()
||
''
,
format
:
this
.
pageInfo
.
format
||
'
markdown
'
,
content
:
this
.
pageInfo
.
content
?.
trim
()
||
''
,
content
:
this
.
pageInfo
.
content
||
''
,
isContentEditorLoading
:
true
,
useContentEditor
:
false
,
commitMessage
:
''
,
...
...
@@ -131,7 +131,7 @@ export default {
computed
:
{
noContent
()
{
if
(
this
.
isContentEditorActive
)
return
this
.
contentEditor
?.
empty
;
return
!
this
.
content
;
return
!
this
.
content
.
trim
()
;
},
csrfToken
()
{
return
csrf
.
token
;
...
...
@@ -326,7 +326,7 @@ export default {
<div
class=
"col-sm-10"
>
<input
id=
"wiki_title"
v-model
.trim
=
"title"
v-model=
"title"
name=
"wiki[title]"
type=
"text"
class=
"form-control"
...
...
@@ -418,7 +418,7 @@ export default {
<textarea
id=
"wiki_content"
ref=
"textarea"
v-model
.trim
=
"content"
v-model=
"content"
name=
"wiki[content]"
class=
"note-textarea js-gfm-input js-autosize markdown-area"
dir=
"auto"
...
...
spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
View file @
e8e492d0
...
...
@@ -63,7 +63,7 @@ describe('WikiForm', () => {
persisted
:
true
,
title
:
'
My page
'
,
content
:
'
My page content
'
,
content
:
'
My page content
'
,
format
:
'
markdown
'
,
path
:
'
/project/path/-/wikis/home
'
,
};
...
...
@@ -129,6 +129,12 @@ describe('WikiForm', () => {
expect
(
findMessage
().
element
.
value
).
toBe
(
'
Update My page
'
);
});
it
(
'
does not trim page content by default
'
,
()
=>
{
createWrapper
(
true
);
expect
(
findContent
().
element
.
value
).
toBe
(
'
My page content
'
);
});
it
.
each
`
value | text
${
'
markdown
'
}
|
${
'
[Link Title](page-slug)
'
}
...
...
@@ -183,10 +189,10 @@ describe('WikiForm', () => {
describe
(
'
when wiki content is updated
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
(
true
);
const
input
=
findContent
();
input
.
setValue
(
'
Lorem ipsum dolar sit!
'
);
input
.
setValue
(
'
Lorem ipsum dolar sit!
'
);
input
.
element
.
dispatchEvent
(
new
Event
(
'
input
'
));
return
wrapper
.
vm
.
$nextTick
();
...
...
@@ -213,6 +219,10 @@ describe('WikiForm', () => {
it
(
'
does not trigger tracking event
'
,
async
()
=>
{
expect
(
trackingSpy
).
not
.
toHaveBeenCalled
();
});
it
(
'
does not trim page content
'
,
()
=>
{
expect
(
findContent
().
element
.
value
).
toBe
(
'
Lorem ipsum dolar sit!
'
);
});
});
});
...
...
@@ -434,7 +444,7 @@ describe('WikiForm', () => {
it
(
'
updates content from content editor on form submit
'
,
async
()
=>
{
// old value
expect
(
findContent
().
element
.
value
).
toBe
(
'
My page content
'
);
expect
(
findContent
().
element
.
value
).
toBe
(
'
My page content
'
);
// wait for content editor to load
await
waitForPromises
();
...
...
@@ -484,7 +494,7 @@ describe('WikiForm', () => {
});
it
(
'
the old editor retains its old value and does not use the content from the content editor
'
,
()
=>
{
expect
(
findContent
().
element
.
value
).
toBe
(
'
My page content
'
);
expect
(
findContent
().
element
.
value
).
toBe
(
'
My page content
'
);
});
});
});
...
...
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