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
Jérome Perrin
gitlab-ce
Commits
ef22b0dc
Commit
ef22b0dc
authored
Sep 29, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Title has now its own test
parent
705a840d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
spec/javascripts/repo/components/repo_file_spec.js
spec/javascripts/repo/components/repo_file_spec.js
+11
-4
No files found.
spec/javascripts/repo/components/repo_file_spec.js
View file @
ef22b0dc
...
@@ -8,14 +8,17 @@ describe('RepoFile', () => {
...
@@ -8,14 +8,17 @@ describe('RepoFile', () => {
icon
:
'
icon
'
,
icon
:
'
icon
'
,
url
:
'
url
'
,
url
:
'
url
'
,
name
:
'
name
'
,
name
:
'
name
'
,
pageTitle
:
'
pageTitle
'
,
lastCommitMessage
:
'
message
'
,
lastCommitMessage
:
'
message
'
,
lastCommitUpdate
:
Date
.
now
(),
lastCommitUpdate
:
Date
.
now
(),
level
:
10
,
level
:
10
,
};
};
const
activeFile
=
{
const
activeFile
=
{
url
:
'
activeUrl
'
,
pageTitle
:
'
pageTitle
'
,
pageTitle
:
'
pageTitle
'
,
url
:
'
url
'
,
};
const
otherFile
=
{
html
:
'
<p class="file-content">html</p>
'
,
pageTitle
:
'
otherpageTitle
'
,
};
};
function
createComponent
(
propsData
)
{
function
createComponent
(
propsData
)
{
...
@@ -31,7 +34,6 @@ describe('RepoFile', () => {
...
@@ -31,7 +34,6 @@ describe('RepoFile', () => {
});
});
it
(
'
renders link, icon, name and last commit details
'
,
()
=>
{
it
(
'
renders link, icon, name and last commit details
'
,
()
=>
{
RepoStore
.
setActiveFiles
(
activeFile
);
const
vm
=
createComponent
({
const
vm
=
createComponent
({
file
,
file
,
activeFile
,
activeFile
,
...
@@ -44,7 +46,6 @@ describe('RepoFile', () => {
...
@@ -44,7 +46,6 @@ describe('RepoFile', () => {
expect
(
name
.
title
).
toEqual
(
file
.
url
);
expect
(
name
.
title
).
toEqual
(
file
.
url
);
expect
(
name
.
href
).
toMatch
(
`/
${
file
.
url
}
`
);
expect
(
name
.
href
).
toMatch
(
`/
${
file
.
url
}
`
);
expect
(
name
.
textContent
.
trim
()).
toEqual
(
file
.
name
);
expect
(
name
.
textContent
.
trim
()).
toEqual
(
file
.
name
);
expect
(
document
.
title
.
trim
()).
toEqual
(
activeFile
.
pageTitle
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-message
'
).
textContent
.
trim
()).
toBe
(
file
.
lastCommitMessage
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-message
'
).
textContent
.
trim
()).
toBe
(
file
.
lastCommitMessage
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-update
'
).
textContent
.
trim
()).
toBe
(
updated
);
expect
(
vm
.
$el
.
querySelector
(
'
.commit-update
'
).
textContent
.
trim
()).
toBe
(
updated
);
expect
(
fileIcon
.
classList
.
contains
(
file
.
icon
)).
toBeTruthy
();
expect
(
fileIcon
.
classList
.
contains
(
file
.
icon
)).
toBeTruthy
();
...
@@ -65,6 +66,12 @@ describe('RepoFile', () => {
...
@@ -65,6 +66,12 @@ describe('RepoFile', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.fa-spin.fa-spinner
'
)).
toBeFalsy
();
expect
(
vm
.
$el
.
querySelector
(
'
.fa-spin.fa-spinner
'
)).
toBeFalsy
();
});
});
it
(
'
sets the document title correctly
'
,
()
=>
{
RepoStore
.
setActiveFiles
(
otherFile
);
expect
(
document
.
title
.
trim
()).
toEqual
(
otherFile
.
pageTitle
);
});
it
(
'
renders a spinner if the file is loading
'
,
()
=>
{
it
(
'
renders a spinner if the file is loading
'
,
()
=>
{
file
.
loading
=
true
;
file
.
loading
=
true
;
const
vm
=
createComponent
({
const
vm
=
createComponent
({
...
...
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