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
5cea2273
Commit
5cea2273
authored
Nov 20, 2019
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate note edited text spec to vue-test-utils
parent
35425750
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
spec/frontend/notes/components/note_edited_text_spec.js
spec/frontend/notes/components/note_edited_text_spec.js
+32
-30
No files found.
spec/frontend/notes/components/note_edited_text_spec.js
View file @
5cea2273
import
Vue
from
'
vue
'
;
import
n
oteEditedText
from
'
~/notes/components/note_edited_text.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
N
oteEditedText
from
'
~/notes/components/note_edited_text.vue
'
;
describe
(
'
note_edited_text
'
,
()
=>
{
let
vm
;
let
props
;
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
noteEditedText
);
props
=
{
const
localVue
=
createLocalVue
();
const
propsData
=
{
actionText
:
'
Edited
'
,
className
:
'
foo-bar
'
,
editedAt
:
'
2017-08-04T09:52:31.062Z
'
,
...
...
@@ -19,29 +14,36 @@ describe('note_edited_text', () => {
state
:
'
active
'
,
username
:
'
root
'
,
},
};
};
describe
(
'
NoteEditedText
'
,
()
=>
{
let
wrapper
;
vm
=
new
Component
({
propsData
:
props
,
}).
$mount
();
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
NoteEditedText
,
{
localVue
,
propsData
,
sync
:
false
,
attachToDocument
:
true
,
});
});
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
it
(
'
should render block with provided className
'
,
()
=>
{
expect
(
vm
.
$el
.
className
).
toEqual
(
props
.
className
);
expect
(
wrapper
.
classes
()).
toContain
(
propsData
.
className
);
});
it
(
'
should render provided actionText
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
props
.
actionText
);
expect
(
wrapper
.
text
().
trim
()).
toContain
(
propsData
.
actionText
);
});
it
(
'
should render provided user information
'
,
()
=>
{
const
authorLink
=
vm
.
$el
.
querySelector
(
'
.js-user-link
'
);
const
authorLink
=
wrapper
.
find
(
'
.js-user-link
'
);
expect
(
authorLink
.
getAttribute
(
'
href
'
)).
toEqual
(
props
.
editedBy
.
path
);
expect
(
authorLink
.
text
Content
.
trim
()).
toEqual
(
props
.
editedBy
.
name
);
expect
(
authorLink
.
attributes
(
'
href
'
)).
toEqual
(
propsData
.
editedBy
.
path
);
expect
(
authorLink
.
text
().
trim
()).
toEqual
(
propsData
.
editedBy
.
name
);
});
});
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