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
f296c491
Commit
f296c491
authored
Feb 10, 2021
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply reviewer feedback
Add datatest-id and use logical OR operator.
parent
0d16e67e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
app/assets/javascripts/vue_shared/components/commit.vue
app/assets/javascripts/vue_shared/components/commit.vue
+10
-4
spec/frontend/vue_shared/components/commit_spec.js
spec/frontend/vue_shared/components/commit_spec.js
+9
-5
No files found.
app/assets/javascripts/vue_shared/components/commit.vue
View file @
f296c491
...
...
@@ -134,7 +134,7 @@ export default {
:
null
;
},
refUrl
()
{
return
this
.
commitRef
.
ref_url
??
this
.
commitRef
.
path
;
return
this
.
commitRef
.
ref_url
||
this
.
commitRef
.
path
;
},
},
};
...
...
@@ -156,9 +156,15 @@ export default {
class=
"ref-name"
>
{{
mergeRequestRef
.
iid
}}
</gl-link
>
<gl-link
v-else
v-gl-tooltip
:href=
"refUrl"
:title=
"commitRef.name"
class=
"ref-name"
>
{{
commitRef
.
name
}}
</gl-link>
<gl-link
v-else
v-gl-tooltip
:href=
"refUrl"
:title=
"commitRef.name"
class=
"ref-name"
data-testid=
"ref-name"
>
{{
commitRef
.
name
}}
</gl-link
>
</
template
>
<gl-icon
name=
"commit"
class=
"commit-icon js-commit-icon"
/>
...
...
spec/frontend/vue_shared/components/commit_spec.js
View file @
f296c491
...
...
@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
CommitComponent
from
'
~/vue_shared/components/commit.vue
'
;
import
UserAvatarLink
from
'
~/vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
describe
(
'
Commit component
'
,
()
=>
{
let
props
;
...
...
@@ -13,11 +14,14 @@ describe('Commit component', () => {
};
const
findUserAvatar
=
()
=>
wrapper
.
find
(
UserAvatarLink
);
const
findRefName
=
()
=>
wrapper
.
findByTestId
(
'
ref-name
'
);
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
CommitComponent
,
{
wrapper
=
extendedWrapper
(
shallowMount
(
CommitComponent
,
{
propsData
,
});
}),
);
};
afterEach
(()
=>
{
...
...
@@ -235,8 +239,8 @@ describe('Commit component', () => {
createComponent
(
props
);
expect
(
wrapper
.
find
(
'
.ref-name
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.ref-name
'
).
attributes
(
'
href
'
)).
toBe
(
props
.
commitRef
.
path
);
expect
(
findRefName
(
).
exists
()).
toBe
(
true
);
expect
(
findRefName
(
).
attributes
(
'
href
'
)).
toBe
(
props
.
commitRef
.
path
);
});
});
});
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