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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
c45646eb
Commit
c45646eb
authored
Sep 04, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Projects Dropdown Frequent Projects Item Component Spec
parent
edffb980
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
spec/javascripts/projects_dropdown/components/projects_list_item_spec.js
...s/projects_dropdown/components/projects_list_item_spec.js
+65
-0
No files found.
spec/javascripts/projects_dropdown/components/projects_list_item_spec.js
0 → 100644
View file @
c45646eb
import
Vue
from
'
vue
'
;
import
projectsListItemComponent
from
'
~/projects_dropdown/components/projects_list_item.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
mockProject
}
from
'
../mock_data
'
;
const
createComponent
=
()
=>
{
const
Component
=
Vue
.
extend
(
projectsListItemComponent
);
return
mountComponent
(
Component
,
{
projectId
:
mockProject
.
id
,
projectName
:
mockProject
.
name
,
namespace
:
mockProject
.
namespace
,
webUrl
:
mockProject
.
webUrl
,
avatarUrl
:
mockProject
.
avatarUrl
,
});
};
describe
(
'
ProjectsListItemComponent
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
hasAvatar
'
,
()
=>
{
it
(
'
should return `true` or `false` if whether avatar is present or not
'
,
()
=>
{
vm
.
avatarUrl
=
'
path/to/avatar.png
'
;
expect
(
vm
.
hasAvatar
).
toBeTruthy
();
vm
.
avatarUrl
=
null
;
expect
(
vm
.
hasAvatar
).
toBeFalsy
();
});
});
describe
(
'
highlightedProjectName
'
,
()
=>
{
it
(
'
should enclose part of project name in <b> & </b> which matches with `matcher` prop
'
,
()
=>
{
vm
.
matcher
=
'
lab
'
;
expect
(
vm
.
highlightedProjectName
).
toContain
(
'
<b>Lab</b>
'
);
});
it
(
'
should return project name as it is if `matcher` is not available
'
,
()
=>
{
vm
.
matcher
=
null
;
expect
(
vm
.
highlightedProjectName
).
toBe
(
mockProject
.
name
);
});
});
});
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component element
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
projects-list-item-container
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.project-item-avatar-container
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.project-item-metadata-container
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.project-title
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.project-namespace
'
).
length
).
toBe
(
1
);
});
});
});
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