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
a26cd123
Commit
a26cd123
authored
Feb 25, 2019
by
Winnie Hellmann
Committed by
Filipa Lacerda
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract ResolveWithIssueButton from NoteableDiscussion component
parent
15528c75
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
10 deletions
+118
-10
app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue
...notes/components/discussion_resolve_with_issue_button.vue
+34
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+9
-10
changelogs/unreleased/refactor-56367-extract-resolve-with-issue-button-component.yml
...tor-56367-extract-resolve-with-issue-button-component.yml
+5
-0
spec/javascripts/notes/components/discussion_resolve_with_issue_button_spec.js
...s/components/discussion_resolve_with_issue_button_spec.js
+31
-0
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+39
-0
No files found.
app/assets/javascripts/notes/components/discussion_resolve_with_issue_button.vue
0 → 100644
View file @
a26cd123
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
GlTooltipDirective
,
GlButton
}
from
'
@gitlab/ui
'
;
export
default
{
name
:
'
ResolveWithIssueButton
'
,
components
:
{
Icon
,
GlButton
,
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
props
:
{
url
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<div
class=
"btn-group"
role=
"group"
>
<gl-button
v-gl-tooltip
:href=
"url"
:title=
"s__('MergeRequests|Resolve this discussion in a new issue')"
class=
"new-issue-for-discussion discussion-create-issue-btn"
>
<icon
name=
"issue-new"
/>
</gl-button>
</div>
</
template
>
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
a26cd123
...
...
@@ -25,6 +25,7 @@ import noteable from '../mixins/noteable';
import
resolvable
from
'
../mixins/resolvable
'
;
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
ResolveWithIssueButton
from
'
./discussion_resolve_with_issue_button.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
import
eventHub
from
'
../event_hub
'
;
...
...
@@ -44,6 +45,7 @@ export default {
ReplyPlaceholder
,
placeholderNote
,
placeholderSystemNote
,
ResolveWithIssueButton
,
systemNote
,
TimelineEntryItem
,
},
...
...
@@ -234,6 +236,9 @@ export default {
url
:
this
.
discussion
.
discussion_path
,
};
},
resolveWithIssuePath
()
{
return
!
this
.
discussionResolved
&&
this
.
discussion
.
resolve_with_issue_path
;
},
},
watch
:
{
isReplying
()
{
...
...
@@ -487,16 +492,10 @@ Please check your network connection and try again.`;
class=
"btn-group discussion-actions ml-sm-2"
role=
"group"
>
<div
v-if=
"!discussionResolved"
class=
"btn-group"
role=
"group"
>
<a
v-gl-tooltip
:href=
"discussion.resolve_with_issue_path"
:title=
"s__('MergeRequests|Resolve this discussion in a new issue')"
class=
"new-issue-for-discussion btn btn-default discussion-create-issue-btn"
>
<icon
name=
"issue-new"
/>
</a>
</div>
<resolve-with-issue-button
v-if=
"resolveWithIssuePath"
:url=
"resolveWithIssuePath"
/>
<jump-to-next-discussion-button
v-if=
"shouldShowJumpToNextDiscussion"
@
onClick=
"jumpToNextDiscussion"
...
...
changelogs/unreleased/refactor-56367-extract-resolve-with-issue-button-component.yml
0 → 100644
View file @
a26cd123
---
title
:
Extracted ResolveWithIssueButton to its own component
merge_request
:
25093
author
:
Martin Hobert
type
:
other
spec/javascripts/notes/components/discussion_resolve_with_issue_button_spec.js
0 → 100644
View file @
a26cd123
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
ResolveWithIssueButton
from
'
~/notes/components/discussion_resolve_with_issue_button.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ResolveWithIssueButton
'
,
()
=>
{
let
wrapper
;
const
url
=
`
${
TEST_HOST
}
/hello-world/`
;
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
ResolveWithIssueButton
,
{
localVue
,
sync
:
false
,
propsData
:
{
url
,
},
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
it should have a link with the provided link property as href
'
,
()
=>
{
const
button
=
wrapper
.
find
(
GlButton
);
expect
(
button
.
attributes
().
href
).
toBe
(
url
);
});
});
spec/javascripts/notes/components/noteable_discussion_spec.js
View file @
a26cd123
...
...
@@ -2,6 +2,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import
createStore
from
'
~/notes/stores
'
;
import
noteableDiscussion
from
'
~/notes/components/noteable_discussion.vue
'
;
import
ReplyPlaceholder
from
'
~/notes/components/discussion_reply_placeholder.vue
'
;
import
ResolveWithIssueButton
from
'
~/notes/components/discussion_resolve_with_issue_button.vue
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
../mock_data
'
;
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
...
...
@@ -238,4 +239,42 @@ describe('noteable_discussion component', () => {
});
});
});
describe
(
'
for resolved discussion
'
,
()
=>
{
beforeEach
(()
=>
{
const
discussion
=
getJSONFixture
(
discussionWithTwoUnresolvedNotes
)[
0
];
wrapper
.
setProps
({
discussion
});
});
it
(
'
does not display a button to resolve with issue
'
,
()
=>
{
const
button
=
wrapper
.
find
(
ResolveWithIssueButton
);
expect
(
button
.
exists
()).
toBe
(
false
);
});
});
describe
(
'
for unresolved discussion
'
,
()
=>
{
beforeEach
(
done
=>
{
const
discussion
=
{
...
getJSONFixture
(
discussionWithTwoUnresolvedNotes
)[
0
],
expanded
:
true
,
};
discussion
.
notes
=
discussion
.
notes
.
map
(
note
=>
({
...
note
,
resolved
:
false
,
}));
wrapper
.
setProps
({
discussion
});
wrapper
.
vm
.
$nextTick
()
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
displays a button to resolve with issue
'
,
()
=>
{
const
button
=
wrapper
.
find
(
ResolveWithIssueButton
);
expect
(
button
.
exists
()).
toBe
(
true
);
});
});
});
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