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
a9ae4ef6
Commit
a9ae4ef6
authored
Aug 28, 2020
by
derek-knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY mock data cleanup
parent
5cad762b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
...nents/rich_content_editor/services/renderers/mock_data.js
+16
-22
No files found.
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
View file @
a9ae4ef6
// Node spec helpers
export
const
buildMockTextNode
=
literal
=>
{
return
{
firstChild
:
null
,
literal
,
type
:
'
text
'
,
};
};
export
const
buildMockTextNode
=
literal
=>
({
literal
,
type
:
'
text
'
});
export
const
normalTextNode
=
buildMockTextNode
(
'
This is just normal text.
'
);
...
...
@@ -23,17 +17,20 @@ const buildMockUneditableOpenToken = type => {
};
};
const
buildMockUneditableCloseToken
=
type
=>
{
return
{
type
:
'
closeTag
'
,
tagName
:
type
};
const
buildMockTextToken
=
content
=>
{
return
{
type
:
'
text
'
,
tagName
:
null
,
content
,
};
};
export
const
originToken
=
{
type
:
'
text
'
,
tagName
:
null
,
content
:
'
{:.no_toc .hidden-md .hidden-lg}
'
,
}
;
const
buildMockUneditableCloseToken
=
type
=>
({
type
:
'
closeTag
'
,
tagName
:
type
});
export
const
originToken
=
buildMockTextToken
(
'
{:.no_toc .hidden-md .hidden-lg}
'
);
const
uneditableOpenToken
=
buildMockUneditableOpenToken
(
'
div
'
);
export
const
uneditableOpenTokens
=
[
uneditableOpenToken
,
originToken
]
;
export
const
uneditableCloseToken
=
buildMockUneditableCloseToken
(
'
div
'
);
export
const
uneditableOpenTokens
=
[
buildMockUneditableOpenToken
(
'
div
'
),
originToken
];
export
const
uneditableCloseTokens
=
[
originToken
,
uneditableCloseToken
];
export
const
uneditableTokens
=
[...
uneditableOpenTokens
,
uneditableCloseToken
];
...
...
@@ -41,6 +38,7 @@ export const originInlineToken = {
type
:
'
text
'
,
content
:
'
<i>Inline</i> content
'
,
};
export
const
uneditableInlineTokens
=
[
buildMockUneditableOpenToken
(
'
a
'
),
originInlineToken
,
...
...
@@ -48,13 +46,9 @@ export const uneditableInlineTokens = [
];
export
const
uneditableBlockTokens
=
[
buildMockUneditableOpenToken
(
'
div
'
),
{
type
:
'
text
'
,
tagName
:
null
,
content
:
'
<div><h1>Some header</h1><p>Some paragraph</p></div>
'
,
},
buildMockUneditableCloseToken
(
'
div
'
),
uneditableOpenToken
,
buildMockTextToken
(
'
<div><h1>Some header</h1><p>Some paragraph</p></div>
'
),
uneditableCloseToken
,
];
export
const
attributeDefinition
=
'
{:.no_toc .hidden-md .hidden-lg}
'
;
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