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
4318afd2
Unverified
Commit
4318afd2
authored
Jul 21, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete repo_file_spec
parent
da75cc56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
6 deletions
+59
-6
repo_file.vue
app/assets/javascripts/repo/repo_file.vue
+1
-1
repo_file_spec.js
spec/javascripts/repo/repo_file_spec.js
+58
-5
No files found.
app/assets/javascripts/repo/repo_file.vue
View file @
4318afd2
...
...
@@ -13,7 +13,7 @@ const RepoFile = {
loading
:
{
type
:
Object
,
required
:
false
,
default
()
{
return
{};
},
default
()
{
return
{
tree
:
false
};
},
},
hasFiles
:
{
type
:
Boolean
,
...
...
spec/javascripts/repo/repo_file_spec.js
View file @
4318afd2
...
...
@@ -21,11 +21,10 @@ describe('RepoFile', () => {
}).
$mount
();
}
it
(
'renders
if not loading tree and has file
s'
,
()
=>
{
it
(
'renders
link, icon, name and last commit detail
s'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
isMini
:
false
,
});
const
icon
=
vm
.
$el
.
querySelector
(
`.
${
file
.
icon
}
`
);
const
name
=
vm
.
$el
.
querySelector
(
'.repo-file-name'
);
...
...
@@ -46,9 +45,63 @@ describe('RepoFile', () => {
expect
(
commitUpdate
.
textContent
).
toBe
(
file
.
lastCommitUpdate
);
});
it
(
'does not render if loading tree or has no files'
,
()
=>
{});
it
(
'does render if hasFiles is true and is loading tree'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
loading
:
{
tree
:
true
,
},
hasFiles
:
true
,
});
expect
(
vm
.
$el
.
innerHTML
).
toBeTruthy
();
});
it
(
'does not render if loading tree'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
loading
:
{
tree
:
true
,
},
});
expect
(
vm
.
$el
.
innerHTML
).
toBeFalsy
();
});
it
(
'does not render commit message and datetime if mini'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
isMini
:
true
,
});
const
commitMessage
=
vm
.
$el
.
querySelector
(
'.commit-message'
);
const
commitUpdate
=
vm
.
$el
.
querySelector
(
'.commit-update'
);
expect
(
commitMessage
).
toBeFalsy
();
expect
(
commitUpdate
).
toBeFalsy
();
});
it
(
'does not set active class if file is active file'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
:
{},
});
it
(
'does not render commit message and datetime if mini'
,
()
=>
{});
expect
(
vm
.
$el
.
classList
.
contains
(
'active'
)).
toBeFalsy
();
});
it
(
'does not set active class if file is active file'
,
()
=>
{});
it
(
'fires linkClicked when the link is clicked'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
});
spyOn
(
vm
,
'linkClicked'
);
vm
.
$el
.
querySelector
(
'.repo-file-name'
).
click
();
expect
(
vm
.
linkClicked
).
toHaveBeenCalled
();
});
});
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