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
bf2313ba
Commit
bf2313ba
authored
Jun 30, 2020
by
derek-knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor rich_content_editor mocks (tighter cohesion)
Appease danger bot with a description...
parent
ae811a1f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
4 deletions
+55
-4
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token_spec.js
..._editor/services/renderers/build_uneditable_token_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
...nents/rich_content_editor/services/renderers/mock_data.js
+45
-0
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_embedded_ruby_spec.js
...nt_editor/services/renderers/render_embedded_ruby_spec.js
+3
-1
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_list_spec.js
...nt_editor/services/renderers/render_kramdown_list_spec.js
+3
-1
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_text_spec.js
...nt_editor/services/renderers/render_kramdown_text_spec.js
+3
-1
No files found.
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token_spec.js
View file @
bf2313ba
...
...
@@ -11,7 +11,7 @@ import {
uneditableCloseToken
,
uneditableCloseTokens
,
uneditableTokens
,
}
from
'
.
./..
/mock_data
'
;
}
from
'
./mock_data
'
;
describe
(
'
Build Uneditable Token renderer helper
'
,
()
=>
{
describe
(
'
buildUneditableOpenTokens
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
0 → 100644
View file @
bf2313ba
// Node spec helpers
export
const
buildMockTextNode
=
literal
=>
{
return
{
firstChild
:
null
,
literal
,
type
:
'
text
'
,
};
};
export
const
buildMockListNode
=
literal
=>
{
return
{
firstChild
:
{
firstChild
:
{
firstChild
:
buildMockTextNode
(
literal
),
type
:
'
paragraph
'
,
},
type
:
'
item
'
,
},
type
:
'
list
'
,
};
};
export
const
normalTextNode
=
buildMockTextNode
(
'
This is just normal text.
'
);
export
const
normalListNode
=
buildMockListNode
(
'
Just another bullet point
'
);
// Token spec helpers
const
uneditableOpenToken
=
{
type
:
'
openTag
'
,
tagName
:
'
div
'
,
attributes
:
{
contenteditable
:
false
},
classNames
:
[
'
gl-px-4 gl-py-2 gl-opacity-5 gl-bg-gray-100 gl-user-select-none gl-cursor-not-allowed
'
,
],
};
export
const
uneditableCloseToken
=
{
type
:
'
closeTag
'
,
tagName
:
'
div
'
};
export
const
originToken
=
{
type
:
'
text
'
,
content
:
'
{:.no_toc .hidden-md .hidden-lg}
'
,
};
export
const
uneditableOpenTokens
=
[
uneditableOpenToken
,
originToken
];
export
const
uneditableCloseTokens
=
[
originToken
,
uneditableCloseToken
];
export
const
uneditableTokens
=
[...
uneditableOpenTokens
,
uneditableCloseToken
];
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_embedded_ruby_spec.js
View file @
bf2313ba
import
renderer
from
'
~/vue_shared/components/rich_content_editor/services/renderers/render_embedded_ruby_text
'
;
import
{
buildUneditableTokens
}
from
'
~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token
'
;
import
{
embeddedRubyTextNode
,
normalTextNode
}
from
'
../../mock_data
'
;
import
{
buildMockTextNode
,
normalTextNode
}
from
'
./mock_data
'
;
const
embeddedRubyTextNode
=
buildMockTextNode
(
'
<%= partial("some/path") %>
'
);
describe
(
'
Render Embedded Ruby Text renderer
'
,
()
=>
{
describe
(
'
canRender
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_list_spec.js
View file @
bf2313ba
...
...
@@ -4,7 +4,9 @@ import {
buildUneditableCloseToken
,
}
from
'
~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token
'
;
import
{
kramdownListNode
,
normalListNode
}
from
'
../../mock_data
'
;
import
{
buildMockListNode
,
normalListNode
}
from
'
./mock_data
'
;
const
kramdownListNode
=
buildMockListNode
(
'
TOC
'
);
describe
(
'
Render Kramdown List renderer
'
,
()
=>
{
describe
(
'
canRender
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_text_spec.js
View file @
bf2313ba
import
renderer
from
'
~/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_text
'
;
import
{
buildUneditableTokens
}
from
'
~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token
'
;
import
{
kramdownTextNode
,
normalTextNode
}
from
'
../../mock_data
'
;
import
{
buildMockTextNode
,
normalTextNode
}
from
'
./mock_data
'
;
const
kramdownTextNode
=
buildMockTextNode
(
'
{:toc}
'
);
describe
(
'
Render Kramdown Text renderer
'
,
()
=>
{
describe
(
'
canRender
'
,
()
=>
{
...
...
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