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
8d2ee368
Commit
8d2ee368
authored
Jun 13, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Click file row in repository Vue app to view file
parent
738f55a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
app/assets/javascripts/repository/components/table/row.vue
app/assets/javascripts/repository/components/table/row.vue
+3
-0
spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
...epository/components/table/__snapshots__/row_spec.js.snap
+1
-0
spec/frontend/repository/components/table/row_spec.js
spec/frontend/repository/components/table/row_spec.js
+30
-1
No files found.
app/assets/javascripts/repository/components/table/row.vue
View file @
8d2ee368
<
script
>
<
script
>
import
{
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
{
getIconName
}
from
'
../../utils/icon
'
;
import
{
getIconName
}
from
'
../../utils/icon
'
;
import
getRefMixin
from
'
../../mixins/get_ref
'
;
import
getRefMixin
from
'
../../mixins/get_ref
'
;
...
@@ -63,6 +64,8 @@ export default {
...
@@ -63,6 +64,8 @@ export default {
openRow
()
{
openRow
()
{
if
(
this
.
isFolder
)
{
if
(
this
.
isFolder
)
{
this
.
$router
.
push
(
this
.
routerLinkTo
);
this
.
$router
.
push
(
this
.
routerLinkTo
);
}
else
{
visitUrl
(
this
.
url
);
}
}
},
},
},
},
...
...
spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
View file @
8d2ee368
...
@@ -15,6 +15,7 @@ exports[`Repository table row component renders table row 1`] = `
...
@@ -15,6 +15,7 @@ exports[`Repository table row component renders table row 1`] = `
<a
<a
class="str-truncated"
class="str-truncated"
href="https://test.com"
>
>
test
test
...
...
spec/frontend/repository/components/table/row_spec.js
View file @
8d2ee368
import
{
shallowMount
,
RouterLinkStub
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
RouterLinkStub
}
from
'
@vue/test-utils
'
;
import
{
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
TableRow
from
'
~/repository/components/table/row.vue
'
;
import
TableRow
from
'
~/repository/components/table/row.vue
'
;
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
let
vm
;
let
vm
;
let
$router
;
let
$router
;
...
@@ -11,7 +14,10 @@ function factory(propsData = {}) {
...
@@ -11,7 +14,10 @@ function factory(propsData = {}) {
};
};
vm
=
shallowMount
(
TableRow
,
{
vm
=
shallowMount
(
TableRow
,
{
propsData
,
propsData
:
{
...
propsData
,
url
:
`https://test.com`
,
},
mocks
:
{
mocks
:
{
$router
,
$router
,
},
},
...
@@ -26,6 +32,7 @@ function factory(propsData = {}) {
...
@@ -26,6 +32,7 @@ function factory(propsData = {}) {
describe
(
'
Repository table row component
'
,
()
=>
{
describe
(
'
Repository table row component
'
,
()
=>
{
afterEach
(()
=>
{
afterEach
(()
=>
{
vm
.
destroy
();
vm
.
destroy
();
jest
.
clearAllMocks
();
});
});
it
(
'
renders table row
'
,
()
=>
{
it
(
'
renders table row
'
,
()
=>
{
...
@@ -77,6 +84,28 @@ describe('Repository table row component', () => {
...
@@ -77,6 +84,28 @@ describe('Repository table row component', () => {
}
}
});
});
it
.
each
`
type | pushes
${
'
tree
'
}
|
${
true
}
${
'
file
'
}
|
${
false
}
${
'
commit
'
}
|
${
false
}
`
(
'
calls visitUrl if $type is not tree
'
,
({
type
,
pushes
})
=>
{
factory
({
id
:
'
1
'
,
path
:
'
test
'
,
type
,
currentPath
:
'
/
'
,
});
vm
.
trigger
(
'
click
'
);
if
(
pushes
)
{
expect
(
visitUrl
).
not
.
toHaveBeenCalled
();
}
else
{
expect
(
visitUrl
).
toHaveBeenCalledWith
(
'
https://test.com
'
);
}
});
it
(
'
renders commit ID for submodule
'
,
()
=>
{
it
(
'
renders commit ID for submodule
'
,
()
=>
{
factory
({
factory
({
id
:
'
1
'
,
id
:
'
1
'
,
...
...
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