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
9cf189f1
Commit
9cf189f1
authored
Jul 14, 2020
by
derek-knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply feedback - add missing test
parent
1de2f6ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token_spec.js
..._editor/services/renderers/build_uneditable_token_spec.js
+17
-5
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
...nents/rich_content_editor/services/renderers/mock_data.js
+15
-0
No files found.
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token_spec.js
View file @
9cf189f1
...
...
@@ -2,16 +2,19 @@ import {
buildUneditableOpenTokens
,
buildUneditableCloseToken
,
buildUneditableCloseTokens
,
buildUneditableInlineTokens
,
buildUneditableTokens
,
buildUneditableInlineTokens
,
buildUneditableHtmlAsTextTokens
,
}
from
'
~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token
'
;
import
{
htmlBlockNode
,
originInlineToken
,
originToken
,
uneditableOpenTokens
,
uneditableCloseToken
,
uneditableCloseTokens
,
uneditableBlockTokens
,
uneditableInlineTokens
,
uneditableTokens
,
}
from
'
./mock_data
'
;
...
...
@@ -41,6 +44,15 @@ describe('Build Uneditable Token renderer helper', () => {
});
});
describe
(
'
buildUneditableTokens
'
,
()
=>
{
it
(
'
returns a 3-item array of tokens with the originToken wrapped in the middle of block tokens
'
,
()
=>
{
const
result
=
buildUneditableTokens
(
originToken
);
expect
(
result
).
toHaveLength
(
3
);
expect
(
result
).
toStrictEqual
(
uneditableTokens
);
});
});
describe
(
'
buildUneditableInlineTokens
'
,
()
=>
{
it
(
'
returns a 3-item array of tokens with the originInlineToken wrapped in the middle of inline tokens
'
,
()
=>
{
const
result
=
buildUneditableInlineTokens
(
originInlineToken
);
...
...
@@ -50,12 +62,12 @@ describe('Build Uneditable Token renderer helper', () => {
});
});
describe
(
'
buildUneditableTokens
'
,
()
=>
{
it
(
'
returns a 3-item array of tokens with the
originToken wrapped
in the middle of block tokens
'
,
()
=>
{
const
result
=
buildUneditable
Tokens
(
originToken
);
describe
(
'
buildUneditable
HtmlAsText
Tokens
'
,
()
=>
{
it
(
'
returns a 3-item array of tokens with the
htmlBlockNode wrapped as a text token
in the middle of block tokens
'
,
()
=>
{
const
result
=
buildUneditable
HtmlAsTextTokens
(
htmlBlockNode
);
expect
(
result
).
toHaveLength
(
3
);
expect
(
result
).
toStrictEqual
(
uneditableTokens
);
expect
(
result
).
toStrictEqual
(
uneditable
Block
Tokens
);
});
});
});
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
View file @
9cf189f1
...
...
@@ -10,6 +10,11 @@ export const buildMockTextNode = literal => {
export
const
normalTextNode
=
buildMockTextNode
(
'
This is just normal text.
'
);
export
const
htmlBlockNode
=
{
type
:
'
htmlBlock
'
,
literal
:
'
<div data-tomark-pass ><h1>Some header</h1><p>Some paragraph</p></div>
'
,
};
// Token spec helpers
const
buildUneditableOpenToken
=
type
=>
{
...
...
@@ -45,3 +50,13 @@ export const uneditableInlineTokens = [
originInlineToken
,
buildUneditableCloseToken
(
'
a
'
),
];
export
const
uneditableBlockTokens
=
[
buildUneditableOpenToken
(
'
div
'
),
{
type
:
'
text
'
,
tagName
:
null
,
content
:
'
<div><h1>Some header</h1><p>Some paragraph</p></div>
'
,
},
buildUneditableCloseToken
(
'
div
'
),
];
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