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
edffb980
Commit
edffb980
authored
Sep 04, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Projects Dropdown Searched Projects List Component Spec
parent
035049c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
spec/javascripts/projects_dropdown/components/projects_list_search_spec.js
...projects_dropdown/components/projects_list_search_spec.js
+84
-0
No files found.
spec/javascripts/projects_dropdown/components/projects_list_search_spec.js
0 → 100644
View file @
edffb980
import
Vue
from
'
vue
'
;
import
projectsListSearchComponent
from
'
~/projects_dropdown/components/projects_list_search.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
mockProject
}
from
'
../mock_data
'
;
const
createComponent
=
()
=>
{
const
Component
=
Vue
.
extend
(
projectsListSearchComponent
);
return
mountComponent
(
Component
,
{
projects
:
[
mockProject
],
matcher
:
'
lab
'
,
searchFailed
:
false
,
});
};
describe
(
'
ProjectsListSearchComponent
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
isListEmpty
'
,
()
=>
{
it
(
'
should return `true` or `false` representing whether if `projects` is empty of not
'
,
()
=>
{
vm
.
projects
=
[];
expect
(
vm
.
isListEmpty
).
toBeTruthy
();
vm
.
projects
=
[
mockProject
];
expect
(
vm
.
isListEmpty
).
toBeFalsy
();
});
});
describe
(
'
listEmptyMessage
'
,
()
=>
{
it
(
'
should return appropriate empty list message based on value of `searchFailed` prop
'
,
()
=>
{
vm
.
searchFailed
=
true
;
expect
(
vm
.
listEmptyMessage
).
toBe
(
'
Something went wrong on our end.
'
);
vm
.
searchFailed
=
false
;
expect
(
vm
.
listEmptyMessage
).
toBe
(
'
No projects matched your query
'
);
});
});
});
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component element with list of projects
'
,
(
done
)
=>
{
vm
.
projects
=
[
mockProject
];
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
projects-list-search-container
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
ul.list-unstyled
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
li.projects-list-item-container
'
).
length
).
toBe
(
1
);
done
();
});
});
it
(
'
should render component element with empty message
'
,
(
done
)
=>
{
vm
.
projects
=
[];
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
li.section-empty
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
li.projects-list-item-container
'
).
length
).
toBe
(
0
);
done
();
});
});
it
(
'
should render component element with failure message
'
,
(
done
)
=>
{
vm
.
searchFailed
=
true
;
vm
.
projects
=
[];
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
li.section-empty.section-failure
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
li.projects-list-item-container
'
).
length
).
toBe
(
0
);
done
();
});
});
});
});
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