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
7b34487e
Commit
7b34487e
authored
Nov 19, 2019
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare system notes spec for bv upgrade
parent
dbd0a8b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
spec/frontend/vue_shared/components/notes/system_note_spec.js
.../frontend/vue_shared/components/notes/system_note_spec.js
+14
-10
No files found.
spec/frontend/vue_shared/components/notes/system_note_spec.js
View file @
7b34487e
import
Vue
from
'
vue
'
;
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
i
ssueSystemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
import
I
ssueSystemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
import
createStore
from
'
~/notes/stores
'
;
import
initMRPopovers
from
'
~/mr_popover/index
'
;
import
initMRPopovers
from
'
~/mr_popover/index
'
;
jest
.
mock
(
'
~/mr_popover/index
'
,
()
=>
jest
.
fn
());
jest
.
mock
(
'
~/mr_popover/index
'
,
()
=>
jest
.
fn
());
const
localVue
=
createLocalVue
();
describe
(
'
system note component
'
,
()
=>
{
describe
(
'
system note component
'
,
()
=>
{
let
vm
;
let
vm
;
let
props
;
let
props
;
...
@@ -30,34 +32,36 @@ describe('system note component', () => {
...
@@ -30,34 +32,36 @@ describe('system note component', () => {
const
store
=
createStore
();
const
store
=
createStore
();
store
.
dispatch
(
'
setTargetNoteHash
'
,
`note_
${
props
.
note
.
id
}
`
);
store
.
dispatch
(
'
setTargetNoteHash
'
,
`note_
${
props
.
note
.
id
}
`
);
const
Component
=
Vue
.
extend
(
issueSystemNote
);
vm
=
mount
(
IssueSystemNote
,
{
vm
=
new
Component
({
store
,
store
,
localVue
,
propsData
:
props
,
propsData
:
props
,
}).
$mount
();
attachToDocument
:
true
,
sync
:
false
,
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
vm
.
$
destroy
();
vm
.
destroy
();
});
});
it
(
'
should render a list item with correct id
'
,
()
=>
{
it
(
'
should render a list item with correct id
'
,
()
=>
{
expect
(
vm
.
$el
.
getAttribute
(
'
id
'
)).
toEqual
(
`note_
${
props
.
note
.
id
}
`
);
expect
(
vm
.
attributes
(
'
id
'
)).
toEqual
(
`note_
${
props
.
note
.
id
}
`
);
});
});
it
(
'
should render target class is note is target note
'
,
()
=>
{
it
(
'
should render target class is note is target note
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
).
toContain
(
'
target
'
);
expect
(
vm
.
classes
()
).
toContain
(
'
target
'
);
});
});
it
(
'
should render svg icon
'
,
()
=>
{
it
(
'
should render svg icon
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.timeline-icon svg
'
)).
toBeDefined
(
);
expect
(
vm
.
find
(
'
.timeline-icon svg
'
).
exists
()).
toBe
(
true
);
});
});
// Redcarpet Markdown renderer wraps text in `<p>` tags
// Redcarpet Markdown renderer wraps text in `<p>` tags
// we need to strip them because they break layout of commit lists in system notes:
// we need to strip them because they break layout of commit lists in system notes:
// https://gitlab.com/gitlab-org/gitlab-foss/uploads/b07a10670919254f0220d3ff5c1aa110/jqzI.png
// https://gitlab.com/gitlab-org/gitlab-foss/uploads/b07a10670919254f0220d3ff5c1aa110/jqzI.png
it
(
'
removes wrapping paragraph from note HTML
'
,
()
=>
{
it
(
'
removes wrapping paragraph from note HTML
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.system-note-message
'
).
innerHTML
).
toContain
(
'
<span>closed</span>
'
);
expect
(
vm
.
find
(
'
.system-note-message
'
).
html
()
).
toContain
(
'
<span>closed</span>
'
);
});
});
it
(
'
should initMRPopovers onMount
'
,
()
=>
{
it
(
'
should initMRPopovers onMount
'
,
()
=>
{
...
...
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