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
Boxiang Sun
gitlab-ce
Commits
e481cdf5
Commit
e481cdf5
authored
Jul 21, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add repo_loading_file_spec
parent
4318afd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
spec/javascripts/repo/repo_loading_file_spec.js
spec/javascripts/repo/repo_loading_file_spec.js
+79
-0
No files found.
spec/javascripts/repo/repo_loading_file_spec.js
0 → 100644
View file @
e481cdf5
import
Vue
from
'
vue
'
;
import
repoLoadingFile
from
'
~/repo/repo_loading_file.vue
'
;
describe
(
'
RepoLoadingFile
'
,
()
=>
{
const
RepoLoadingFile
=
Vue
.
extend
(
repoLoadingFile
);
function
createComponent
(
propsData
)
{
return
new
RepoLoadingFile
({
propsData
,
}).
$mount
();
}
function
assertLines
(
lines
)
{
lines
.
forEach
((
line
,
n
)
=>
{
const
index
=
n
+
1
;
expect
(
line
.
classList
.
contains
(
`line-of-code-
${
index
}
`
)).
toBeTruthy
();
});
}
function
assertColumns
(
columns
)
{
columns
.
forEach
((
column
)
=>
{
const
container
=
column
.
querySelector
(
'
.animation-container
'
);
const
lines
=
[...
container
.
querySelectorAll
(
'
:scope > div
'
)];
expect
(
container
).
toBeTruthy
();
expect
(
lines
.
length
).
toEqual
(
6
);
assertLines
(
lines
);
});
}
it
(
'
renders 3 columns of animated LoC
'
,
()
=>
{
const
vm
=
createComponent
({
loading
:
{
tree
:
true
,
},
hasFiles
:
false
,
});
const
columns
=
[...
vm
.
$el
.
querySelectorAll
(
'
td
'
)];
expect
(
columns
.
length
).
toEqual
(
3
);
assertColumns
(
columns
);
});
it
(
'
renders 1 column of animated LoC if isMini
'
,
()
=>
{
const
vm
=
createComponent
({
loading
:
{
tree
:
true
,
},
hasFiles
:
false
,
isMini
:
true
,
});
const
columns
=
[...
vm
.
$el
.
querySelectorAll
(
'
td
'
)];
expect
(
columns
.
length
).
toEqual
(
1
);
assertColumns
(
columns
);
});
it
(
'
does not render if tree is not loading
'
,
()
=>
{
const
vm
=
createComponent
({
loading
:
{
tree
:
false
,
},
hasFiles
:
false
,
});
expect
(
vm
.
$el
.
innerHTML
).
toBeFalsy
();
});
it
(
'
does not render if hasFiles is true
'
,
()
=>
{
const
vm
=
createComponent
({
loading
:
{
tree
:
true
,
},
hasFiles
:
true
,
});
expect
(
vm
.
$el
.
innerHTML
).
toBeFalsy
();
});
});
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