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
75e5be77
Commit
75e5be77
authored
Nov 21, 2019
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare user popover for vb upgrade
parent
ad6f7e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
...d/vue_shared/components/user_popover/user_popover_spec.js
+19
-18
No files found.
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
View file @
75e5be77
import
UserPopover
from
'
~/vue_shared/components/user_popover/user_popover.vue
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlSkeletonLoading
}
from
'
@gitlab/ui
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
const
DEFAULT_PROPS
=
{
loaded
:
true
,
...
...
@@ -29,7 +31,7 @@ describe('User Popover Component', () => {
describe
(
'
Empty
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
target
:
document
.
querySelector
(
'
.js-user-link
'
),
user
:
{
...
...
@@ -41,18 +43,19 @@ describe('User Popover Component', () => {
status
:
null
,
},
},
attachToDocument
:
true
,
sync
:
false
,
});
});
it
(
'
should return skeleton loaders
'
,
()
=>
{
expect
(
wrapper
.
find
All
(
'
.animation-container
'
).
length
).
toBe
(
4
);
expect
(
wrapper
.
find
(
GlSkeletonLoading
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
basic data
'
,
()
=>
{
it
(
'
should show basic fields
'
,
()
=>
{
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
DEFAULT_PROPS
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -66,9 +69,9 @@ describe('User Popover Component', () => {
});
it
(
'
shows icon for location
'
,
()
=>
{
const
iconEl
=
wrapper
.
find
(
'
.js-location svg
'
);
const
iconEl
=
wrapper
.
find
(
Icon
);
expect
(
iconEl
.
find
(
'
use
'
).
element
.
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
location
'
);
expect
(
iconEl
.
props
(
'
name
'
)).
toEqual
(
'
location
'
);
});
});
...
...
@@ -77,7 +80,7 @@ describe('User Popover Component', () => {
const
testProps
=
Object
.
assign
({},
DEFAULT_PROPS
);
testProps
.
user
.
bio
=
'
Engineer
'
;
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
testProps
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -92,7 +95,7 @@ describe('User Popover Component', () => {
const
testProps
=
Object
.
assign
({},
DEFAULT_PROPS
);
testProps
.
user
.
organization
=
'
GitLab
'
;
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
testProps
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -108,7 +111,7 @@ describe('User Popover Component', () => {
testProps
.
user
.
bio
=
'
Engineer
'
;
testProps
.
user
.
organization
=
'
GitLab
'
;
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
DEFAULT_PROPS
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -125,7 +128,7 @@ describe('User Popover Component', () => {
testProps
.
user
.
bio
=
'
Manager & Team Lead
'
;
testProps
.
user
.
organization
=
'
Me & my <funky> Company
'
;
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
DEFAULT_PROPS
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -138,15 +141,13 @@ describe('User Popover Component', () => {
});
it
(
'
shows icon for bio
'
,
()
=>
{
const
iconEl
=
wrapper
.
find
(
'
.js-bio svg
'
);
expect
(
iconEl
.
find
(
'
use
'
).
element
.
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
profile
'
);
expect
(
wrapper
.
findAll
(
Icon
).
filter
(
icon
=>
icon
.
props
(
'
name
'
)
===
'
profile
'
).
length
).
toEqual
(
1
,
);
});
it
(
'
shows icon for organization
'
,
()
=>
{
const
iconEl
=
wrapper
.
find
(
'
.js-organization svg
'
);
expect
(
iconEl
.
find
(
'
use
'
).
element
.
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
work
'
);
expect
(
wrapper
.
findAll
(
Icon
).
filter
(
icon
=>
icon
.
props
(
'
name
'
)
===
'
work
'
).
length
).
toEqual
(
1
);
});
});
...
...
@@ -155,7 +156,7 @@ describe('User Popover Component', () => {
const
testProps
=
Object
.
assign
({},
DEFAULT_PROPS
);
testProps
.
user
.
status
=
{
message_html
:
'
Hello World
'
};
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
DEFAULT_PROPS
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
@@ -170,7 +171,7 @@ describe('User Popover Component', () => {
const
testProps
=
Object
.
assign
({},
DEFAULT_PROPS
);
testProps
.
user
.
status
=
{
emoji
:
'
basketball_player
'
,
message_html
:
'
Hello World
'
};
wrapper
=
m
ount
(
UserPopover
,
{
wrapper
=
shallowM
ount
(
UserPopover
,
{
propsData
:
{
...
DEFAULT_PROPS
,
target
:
document
.
querySelector
(
'
.js-user-link
'
),
...
...
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