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
edd7f5eb
Commit
edd7f5eb
authored
Jul 22, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide
parents
6622cde6
1f95d37d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
1 deletion
+180
-1
repo_file_spec.js
spec/javascripts/repo/repo_file_spec.js
+1
-1
repo_loading_file_spec.js
spec/javascripts/repo/repo_loading_file_spec.js
+79
-0
repo_prev_directory_spec.js
spec/javascripts/repo/repo_prev_directory_spec.js
+30
-0
repo_tab_spec.js
spec/javascripts/repo/repo_tab_spec.js
+70
-0
No files found.
spec/javascripts/repo/repo_file_spec.js
View file @
edd7f5eb
...
...
@@ -102,6 +102,6 @@ describe('RepoFile', () => {
vm
.
$el
.
querySelector
(
'.repo-file-name'
).
click
();
expect
(
vm
.
linkClicked
).
toHaveBeenCalled
(
);
expect
(
vm
.
linkClicked
).
toHaveBeenCalled
With
(
file
);
});
});
spec/javascripts/repo/repo_loading_file_spec.js
0 → 100644
View file @
edd7f5eb
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
();
});
});
spec/javascripts/repo/repo_prev_directory_spec.js
0 → 100644
View file @
edd7f5eb
import
Vue
from
'vue'
;
import
repoPrevDirectory
from
'~/repo/repo_prev_directory.vue'
;
describe
(
'RepoPrevDirectory'
,
()
=>
{
const
RepoPrevDirectory
=
Vue
.
extend
(
repoPrevDirectory
);
function
createComponent
(
propsData
)
{
return
new
RepoPrevDirectory
({
propsData
,
}).
$mount
();
}
it
(
'renders a prev dir link'
,
()
=>
{
const
prevUrl
=
'prevUrl'
;
const
vm
=
createComponent
({
prevUrl
,
});
const
link
=
vm
.
$el
.
querySelector
(
'a'
);
spyOn
(
vm
,
'linkClicked'
);
expect
(
link
).
toBeTruthy
();
expect
(
link
.
href
).
toMatch
(
`/
${
prevUrl
}
`
);
expect
(
link
.
textContent
).
toEqual
(
'..'
);
link
.
click
();
expect
(
vm
.
linkClicked
).
toHaveBeenCalledWith
(
prevUrl
);
});
});
spec/javascripts/repo/repo_tab_spec.js
0 → 100644
View file @
edd7f5eb
import
Vue
from
'vue'
;
import
repoTab
from
'~/repo/repo_tab.vue'
;
describe
(
'RepoTab'
,
()
=>
{
const
RepoTab
=
Vue
.
extend
(
repoTab
);
function
createComponent
(
propsData
)
{
return
new
RepoTab
({
propsData
,
}).
$mount
();
}
it
(
'renders a close link and a name link'
,
()
=>
{
const
tab
=
{
loading
:
false
,
url
:
'url'
,
name
:
'name'
,
};
const
vm
=
createComponent
({
tab
,
});
const
close
=
vm
.
$el
.
querySelector
(
'.close'
);
const
name
=
vm
.
$el
.
querySelector
(
`a[title="
${
tab
.
url
}
"]`
)
spyOn
(
vm
,
'xClicked'
);
spyOn
(
vm
,
'tabClicked'
);
expect
(
close
).
toBeTruthy
();
expect
(
close
.
querySelector
(
'.fa-times'
)).
toBeTruthy
();
expect
(
name
).
toBeTruthy
();
expect
(
name
.
textContent
).
toEqual
(
tab
.
name
);
close
.
click
();
name
.
click
();
expect
(
vm
.
xClicked
).
toHaveBeenCalledWith
(
tab
);
expect
(
vm
.
tabClicked
).
toHaveBeenCalledWith
(
tab
);
});
it
(
'renders a spinner if tab is loading'
,
()
=>
{
const
tab
=
{
loading
:
true
,
url
:
'url'
,
};
const
vm
=
createComponent
({
tab
,
});
const
close
=
vm
.
$el
.
querySelector
(
'.close'
);
const
name
=
vm
.
$el
.
querySelector
(
`a[title="
${
tab
.
url
}
"]`
);
expect
(
close
).
toBeFalsy
();
expect
(
name
).
toBeFalsy
();
expect
(
vm
.
$el
.
querySelector
(
'.fa.fa-spinner.fa-spin'
)).
toBeTruthy
();
});
it
(
'renders an fa-circle icon if tab is changed'
,
()
=>
{
const
tab
=
{
loading
:
false
,
url
:
'url'
,
name
:
'name'
,
changed
:
true
,
};
const
vm
=
createComponent
({
tab
,
});
const
close
=
vm
.
$el
.
querySelector
(
'.close'
);
expect
(
close
.
querySelector
(
'.fa-circle'
)).
toBeTruthy
();
});
});
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