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
7b2f58cb
Commit
7b2f58cb
authored
Jul 26, 2021
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove build_serializer_config function
parent
ada1729d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
60 deletions
+0
-60
app/assets/javascripts/content_editor/services/build_serializer_config.js
...cripts/content_editor/services/build_serializer_config.js
+0
-22
spec/frontend/content_editor/services/build_serializer_config_spec.js
...d/content_editor/services/build_serializer_config_spec.js
+0
-38
No files found.
app/assets/javascripts/content_editor/services/build_serializer_config.js
deleted
100644 → 0
View file @
ada1729d
const
buildSerializerConfig
=
(
extensions
=
[])
=>
extensions
.
filter
(({
serializer
})
=>
serializer
)
.
reduce
(
(
serializers
,
{
serializer
,
tiptapExtension
:
{
name
,
type
}
})
=>
{
const
collection
=
`
${
type
}
s`
;
return
{
...
serializers
,
[
collection
]:
{
...
serializers
[
collection
],
[
name
]:
serializer
,
},
};
},
{
nodes
:
{},
marks
:
{},
},
);
export
default
buildSerializerConfig
;
spec/frontend/content_editor/services/build_serializer_config_spec.js
deleted
100644 → 0
View file @
ada1729d
import
*
as
Blockquote
from
'
~/content_editor/extensions/blockquote
'
;
import
*
as
Bold
from
'
~/content_editor/extensions/bold
'
;
import
*
as
Dropcursor
from
'
~/content_editor/extensions/dropcursor
'
;
import
*
as
Paragraph
from
'
~/content_editor/extensions/paragraph
'
;
import
buildSerializerConfig
from
'
~/content_editor/services/build_serializer_config
'
;
describe
(
'
content_editor/services/build_serializer_config
'
,
()
=>
{
describe
(
'
given one or more content editor extensions
'
,
()
=>
{
it
(
'
creates a serializer config that collects all extension serializers by type
'
,
()
=>
{
const
extensions
=
[
Bold
,
Blockquote
,
Paragraph
];
const
serializerConfig
=
buildSerializerConfig
(
extensions
);
extensions
.
forEach
(({
tiptapExtension
,
serializer
})
=>
{
const
{
name
,
type
}
=
tiptapExtension
;
expect
(
serializerConfig
[
`
${
type
}
s`
][
name
]).
toBe
(
serializer
);
});
});
});
describe
(
'
given an extension without serializer
'
,
()
=>
{
it
(
'
does not include the extension in the serializer config
'
,
()
=>
{
const
serializerConfig
=
buildSerializerConfig
([
Dropcursor
]);
expect
(
serializerConfig
.
marks
[
Dropcursor
.
tiptapExtension
.
name
]).
toBe
(
undefined
);
expect
(
serializerConfig
.
nodes
[
Dropcursor
.
tiptapExtension
.
name
]).
toBe
(
undefined
);
});
});
describe
(
'
given no extensions
'
,
()
=>
{
it
(
'
creates an empty serializer config
'
,
()
=>
{
expect
(
buildSerializerConfig
()).
toStrictEqual
({
marks
:
{},
nodes
:
{},
});
});
});
});
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