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
Léo-Paul Géneau
gitlab-ce
Commits
1cb18b00
Commit
1cb18b00
authored
Aug 02, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Improved repo_file_spec
parent
a1f2bd7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
app/assets/javascripts/repo/repo_file.vue
app/assets/javascripts/repo/repo_file.vue
+1
-1
spec/javascripts/repo/repo_file_options_spec.js
spec/javascripts/repo/repo_file_options_spec.js
+1
-1
spec/javascripts/repo/repo_file_spec.js
spec/javascripts/repo/repo_file_spec.js
+20
-1
No files found.
app/assets/javascripts/repo/repo_file.vue
View file @
1cb18b00
...
...
@@ -42,7 +42,7 @@ export default RepoFile;
<
template
>
<tr
class=
"file"
v-if=
"!loading.tree || hasFiles"
:class=
"
{'active': activeFile.url === file.url}">
<td
@
click.prevent=
"linkClicked(file)"
>
<i
class=
"fa"
v-if=
"!file.loading"
:class=
"file.icon"
:style=
"
{'margin-left': file.level * 10 + 'px'}">
</i>
<i
class=
"fa
file-icon
"
v-if=
"!file.loading"
:class=
"file.icon"
:style=
"
{'margin-left': file.level * 10 + 'px'}">
</i>
<i
class=
"fa fa-spinner fa-spin"
v-if=
"file.loading"
:style=
"
{'margin-left': file.level * 10 + 'px'}">
</i>
<a
:href=
"file.url"
class=
"repo-file-name"
:title=
"file.url"
>
{{
file
.
name
}}
</a>
</td>
...
...
spec/javascripts/repo/repo_file_options_spec.js
View file @
1cb18b00
import
Vue
from
'
vue
'
;
import
repoFileOptions
from
'
~/repo/repo_file_options.vue
'
;
f
describe
(
'
RepoFileOptions
'
,
()
=>
{
describe
(
'
RepoFileOptions
'
,
()
=>
{
const
projectName
=
'
projectName
'
;
function
createComponent
(
propsData
)
{
...
...
spec/javascripts/repo/repo_file_spec.js
View file @
1cb18b00
import
Vue
from
'
vue
'
;
import
repoFile
from
'
~/repo/repo_file.vue
'
;
describe
(
'
RepoFile
'
,
()
=>
{
f
describe
(
'
RepoFile
'
,
()
=>
{
const
updated
=
'
updated
'
;
const
file
=
{
icon
:
'
icon
'
,
...
...
@@ -33,6 +33,7 @@ describe('RepoFile', () => {
activeFile
,
});
const
name
=
vm
.
$el
.
querySelector
(
'
.repo-file-name
'
);
const
fileIcon
=
vm
.
$el
.
querySelector
(
'
.file-icon
'
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
active
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
`.
${
file
.
icon
}
`
).
style
.
marginLeft
).
toEqual
(
'
100px
'
);
...
...
@@ -41,6 +42,8 @@ describe('RepoFile', () => {
expect
(
name
.
textContent
).
toEqual
(
file
.
name
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-message
'
).
textContent
).
toBe
(
file
.
lastCommitMessage
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-update
'
).
textContent
).
toBe
(
updated
);
expect
(
fileIcon
.
classList
.
contains
(
file
.
icon
)).
toBeTruthy
();
expect
(
fileIcon
.
style
.
marginLeft
).
toEqual
(
`
${
file
.
level
*
10
}
px`
);
});
it
(
'
does render if hasFiles is true and is loading tree
'
,
()
=>
{
...
...
@@ -54,6 +57,22 @@ describe('RepoFile', () => {
});
expect
(
vm
.
$el
.
innerHTML
).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
.fa-spin.fa-spinner
'
)).
toBeFalsy
();
});
it
(
'
renders a spinner if the file is loading
'
,
()
=>
{
file
.
loading
=
true
;
const
vm
=
createComponent
({
file
,
activeFile
,
loading
:
{
tree
:
true
,
},
hasFiles
:
true
,
});
expect
(
vm
.
$el
.
innerHTML
).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
.fa-spin.fa-spinner
'
).
style
.
marginLeft
).
toEqual
(
`
${
file
.
level
*
10
}
px`
);
});
it
(
'
does not render if loading tree
'
,
()
=>
{
...
...
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