BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
035049c6
Commit
035049c6
authored
Sep 04, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Projects Dropdown Frequent Projects List Component Spec
parent
cc807277
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
projects_list_frequent_spec.js
...ojects_dropdown/components/projects_list_frequent_spec.js
+72
-0
No files found.
spec/javascripts/projects_dropdown/components/projects_list_frequent_spec.js
0 → 100644
View file @
035049c6
import
Vue
from
'vue'
;
import
projectsListFrequentComponent
from
'~/projects_dropdown/components/projects_list_frequent.vue'
;
import
mountComponent
from
'../../helpers/vue_mount_component_helper'
;
import
{
mockFrequents
}
from
'../mock_data'
;
const
createComponent
=
()
=>
{
const
Component
=
Vue
.
extend
(
projectsListFrequentComponent
);
return
mountComponent
(
Component
,
{
projects
:
mockFrequents
,
localStorageFailed
:
false
,
});
};
describe
(
'ProjectsListFrequentComponent'
,
()
=>
{
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
=
mockFrequents
;
expect
(
vm
.
isListEmpty
).
toBeFalsy
();
});
});
describe
(
'listEmptyMessage'
,
()
=>
{
it
(
'should return appropriate empty list message based on value of `localStorageFailed` prop'
,
()
=>
{
vm
.
localStorageFailed
=
true
;
expect
(
vm
.
listEmptyMessage
).
toBe
(
'This feature requires browser localStorage support'
);
vm
.
localStorageFailed
=
false
;
expect
(
vm
.
listEmptyMessage
).
toBe
(
'Projects you visit often will appear here'
);
});
});
});
describe
(
'template'
,
()
=>
{
it
(
'should render component element with list of projects'
,
(
done
)
=>
{
vm
.
projects
=
mockFrequents
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'projects-list-frequent-container'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelectorAll
(
'ul.list-unstyled'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'li.projects-list-item-container'
).
length
).
toBe
(
5
);
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
();
});
});
});
});
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