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
ef6c614e
Commit
ef6c614e
authored
Apr 14, 2021
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add top toolbar to content editor
parent
83b869ac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
15 deletions
+31
-15
app/assets/javascripts/content_editor/components/content_editor.vue
.../javascripts/content_editor/components/content_editor.vue
+13
-6
spec/frontend/content_editor/components/content_editor_spec.js
...frontend/content_editor/components/content_editor_spec.js
+18
-8
spec/frontend/content_editor/components/top_toolbar_spec.js
spec/frontend/content_editor/components/top_toolbar_spec.js
+0
-1
No files found.
app/assets/javascripts/content_editor/components/content_editor.vue
View file @
ef6c614e
<
script
>
import
{
EditorContent
}
from
'
tiptap
'
;
import
createEditor
from
'
../services/create_editor
'
;
import
TopToolbar
from
'
./top_toolbar.vue
'
;
export
default
{
components
:
{
EditorContent
,
TopToolbar
,
},
props
:
{
editor
:
{
type
:
Object
,
required
:
true
,
},
data
()
{
return
{
editor
:
createEditor
(),
};
},
};
</
script
>
<
template
>
<editor-content
:editor=
"editor"
/>
<div
class=
"gl-display-flex gl-flex-direction-column gl-p-3 gl-border-solid gl-border-1 gl-border-gray-200 gl-rounded-base"
>
<top-toolbar
class=
"gl-mb-3"
:editor=
"editor"
/>
<editor-content
class=
"md"
:editor=
"editor"
/>
</div>
</
template
>
spec/frontend/content_editor/components/content_editor_spec.js
View file @
ef6c614e
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
EditorContent
}
from
'
tiptap
'
;
import
ContentEditor
from
'
~/content_editor/components/content_editor.vue
'
;
import
TopToolbar
from
'
~/content_editor/components/top_toolbar.vue
'
;
import
createEditor
from
'
~/content_editor/services/create_editor
'
;
jest
.
mock
(
'
~/content_editor/services/create_editor
'
);
import
createMarkdownSerializer
from
'
~/content_editor/services/markdown_serializer
'
;
describe
(
'
ContentEditor
'
,
()
=>
{
let
wrapper
;
let
editor
;
const
buildWrapper
=
()
=>
{
wrapper
=
shallowMount
(
ContentEditor
);
const
buildWrapper
=
async
()
=>
{
editor
=
await
createEditor
({
serializer
:
createMarkdownSerializer
({
toHTML
:
()
=>
''
})
});
wrapper
=
shallowMount
(
ContentEditor
,
{
propsData
:
{
editor
,
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders editor content component and attaches editor instance
'
,
()
=>
{
const
editor
=
{}
;
it
(
'
renders editor content component and attaches editor instance
'
,
async
()
=>
{
await
buildWrapper
()
;
createEditor
.
mockReturnValueOnce
(
editor
);
buildWrapper
();
expect
(
wrapper
.
findComponent
(
EditorContent
).
props
().
editor
).
toBe
(
editor
);
});
it
(
'
renders top toolbar component and attaches editor instance
'
,
async
()
=>
{
await
buildWrapper
();
expect
(
wrapper
.
findComponent
(
TopToolbar
).
props
().
editor
).
toBe
(
editor
);
});
});
spec/frontend/content_editor/components/top_toolbar_spec.js
View file @
ef6c614e
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
ToolbarButton
from
'
~/content_editor/components/toolbar_button.vue
'
;
import
TopToolbar
from
'
~/content_editor/components/top_toolbar.vue
'
;
describe
(
'
content_editor/components/top_toolbar
'
,
()
=>
{
...
...
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