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
da75cc56
Commit
da75cc56
authored
Jul 21, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started on repo_file spec
parent
c7145944
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
2 deletions
+92
-2
app/assets/javascripts/repo/repo_file.vue
app/assets/javascripts/repo/repo_file.vue
+2
-2
spec/javascripts/repo/repo_file_options_spec.js
spec/javascripts/repo/repo_file_options_spec.js
+36
-0
spec/javascripts/repo/repo_file_spec.js
spec/javascripts/repo/repo_file_spec.js
+54
-0
No files found.
app/assets/javascripts/repo/repo_file.vue
View file @
da75cc56
...
...
@@ -13,7 +13,7 @@ const RepoFile = {
loading
:
{
type
:
Object
,
required
:
false
,
default
:
{
},
default
()
{
return
{};
},
},
hasFiles
:
{
type
:
Boolean
,
...
...
@@ -48,7 +48,7 @@ export default RepoFile;
</td>
<td
v-if=
"!isMini"
class=
"hidden-xs"
>
<span>
{{
file
.
lastCommitUpdate
}}
</span>
<span
class=
"commit-update"
>
{{
file
.
lastCommitUpdate
}}
</span>
</td>
</tr>
</
template
>
spec/javascripts/repo/repo_file_options_spec.js
0 → 100644
View file @
da75cc56
import
Vue
from
'
vue
'
;
import
repoFileOptions
from
'
~/repo/repo_file_options.vue
'
;
describe
(
'
RepoFileOptions
'
,
()
=>
{
const
RepoFileOptions
=
Vue
.
extend
(
repoFileOptions
);
const
projectName
=
'
projectName
'
;
function
createComponent
(
propsData
)
{
return
new
RepoFileOptions
({
propsData
,
}).
$mount
();
}
it
(
'
renders the title and new file/folder buttons if isMini is true
'
,
()
=>
{
const
vm
=
createComponent
({
isMini
:
true
,
projectName
,
});
const
title
=
vm
.
$el
.
querySelector
(
'
.title
'
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
repo-file-options
'
)).
toBeTruthy
();
expect
(
title
).
toBeTruthy
();
expect
(
title
.
textContent
).
toEqual
(
projectName
);
expect
(
vm
.
$el
.
querySelector
(
'
a[title="New File"]
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
a[title="New Folder"]
'
)).
toBeTruthy
();
});
it
(
'
does not render if isMini is false
'
,
()
=>
{
const
vm
=
createComponent
({
isMini
:
false
,
projectName
,
});
expect
(
vm
.
$el
.
innerHTML
).
toBeFalsy
();
});
});
spec/javascripts/repo/repo_file_spec.js
0 → 100644
View file @
da75cc56
import
Vue
from
'
vue
'
;
import
repoFile
from
'
~/repo/repo_file.vue
'
;
describe
(
'
RepoFile
'
,
()
=>
{
const
RepoFile
=
Vue
.
extend
(
repoFile
);
const
file
=
{
icon
:
'
icon
'
,
url
:
'
url
'
,
name
:
'
name
'
,
lastCommitMessage
:
'
message
'
,
lastCommitUpdate
:
'
update
'
,
level
:
10
,
};
const
activeFile
=
{
url
:
'
url
'
,
};
function
createComponent
(
propsData
)
{
return
new
RepoFile
({
propsData
,
}).
$mount
();
}
it
(
'
renders if not loading tree and has files
'
,
()
=>
{
const
vm
=
createComponent
({
file
,
activeFile
,
isMini
:
false
,
});
const
icon
=
vm
.
$el
.
querySelector
(
`.
${
file
.
icon
}
`
);
const
name
=
vm
.
$el
.
querySelector
(
'
.repo-file-name
'
);
const
commitMessage
=
vm
.
$el
.
querySelector
(
'
.commit-message
'
);
const
commitUpdate
=
vm
.
$el
.
querySelector
(
'
.commit-update
'
);
expect
(
vm
.
$el
.
innerHTML
).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
active
'
)).
toBeTruthy
();
expect
(
icon
).
toBeTruthy
();
expect
(
icon
.
style
.
marginLeft
).
toEqual
(
'
100px
'
);
expect
(
name
).
toBeTruthy
();
expect
(
name
.
title
).
toEqual
(
file
.
url
);
expect
(
name
.
href
).
toMatch
(
`/
${
file
.
url
}
`
);
expect
(
name
.
textContent
).
toEqual
(
file
.
name
);
expect
(
commitMessage
).
toBeTruthy
();
expect
(
commitMessage
.
textContent
).
toBe
(
file
.
lastCommitMessage
);
expect
(
commitUpdate
).
toBeTruthy
();
expect
(
commitUpdate
.
textContent
).
toBe
(
file
.
lastCommitUpdate
);
});
it
(
'
does not render if loading tree or has no files
'
,
()
=>
{});
it
(
'
does not render commit message and datetime if mini
'
,
()
=>
{});
it
(
'
does not set active class if file is active file
'
,
()
=>
{});
});
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