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
3c946b93
Commit
3c946b93
authored
Jul 17, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Fix Rspec tests.
parent
72dfc763
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
45 deletions
+56
-45
issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+20
-12
issue_notes.vue
app/assets/javascripts/notes/components/issue_notes.vue
+2
-0
index.js
app/assets/javascripts/notes/index.js
+16
-7
_close_reopen_report_toggle.html.haml
...ews/shared/issuable/_close_reopen_report_toggle.html.haml
+1
-1
note_polling_spec.rb
spec/features/issues/note_polling_spec.rb
+4
-12
discussion_comments_shared_example.rb
spec/support/features/discussion_comments_shared_example.rb
+13
-13
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
3c946b93
...
...
@@ -45,6 +45,14 @@ export default {
return
this
.
isIssueOpen
?
'Close issue'
:
'Reopen issue'
;
},
actionButtonClassNames
()
{
return
{
'btn-reopen'
:
!
this
.
isIssueOpen
,
'btn-close'
:
this
.
isIssueOpen
,
'js-note-target-close'
:
this
.
isIssueOpen
,
'js-note-target-reopen'
:
!
this
.
isIssueOpen
,
}
},
},
methods
:
{
handleSave
(
withIssueAction
)
{
...
...
@@ -173,8 +181,8 @@ export default {
@
keydown
.
meta
.
enter=
"handleSave()"
>
</textarea>
</markdown-field>
<div
class=
"note-form-actions
clearfix
"
>
<div
class=
"pull-left btn-group append-right-10 comment-type-dropdown js-comment-type-dropdown"
>
<div
class=
"note-form-actions"
>
<div
class=
"pull-left btn-group append-right-10 comment-type-dropdown js-comment-type-dropdown
droplab-dropdown
"
>
<button
@
click=
"handleSave()"
:disabled=
"!note.length"
...
...
@@ -196,41 +204,41 @@ export default {
<ul
class=
"note-type-dropdown dropdown-open-top dropdown-menu"
>
<li
:class=
"
{ 'item-selected': noteType === 'comment' }"
:class=
"
{ '
droplab-
item-selected': noteType === 'comment' }"
@click.prevent="setNoteType('comment')">
<
a
href=
"#
"
>
<
button
class=
"btn btn-transparent
"
>
<i
aria-hidden=
"true"
class=
"fa fa-check"
></i>
class=
"fa fa-check
icon
"
></i>
<div
class=
"description"
>
<strong>
Comment
</strong>
<p>
Add a general comment to this issue.
</p>
</div>
</
a
>
</
button
>
</li>
<li
class=
"divider"
></li>
<li
class=
"divider
droplab-item-ignore
"
></li>
<li
:class=
"
{ 'item-selected': noteType === 'discussion' }"
:class=
"
{ '
droplab-
item-selected': noteType === 'discussion' }"
@click.prevent="setNoteType('discussion')">
<
a
href=
"#
"
>
<
button
class=
"btn btn-transparent
"
>
<i
aria-hidden=
"true"
class=
"fa fa-check"
></i>
class=
"fa fa-check
icon
"
></i>
<div
class=
"description"
>
<strong>
Start discussion
</strong>
<p>
Discuss a specific suggestion or question.
</p>
</div>
</
a
>
</
button
>
</li>
</ul>
</div>
<a
@
click=
"handleSave(true)"
:class=
"
{'btn-reopen': !isIssueOpen, 'btn-close': isIssueOpen}
"
:class=
"
actionButtonClassNames
"
class=
"btn btn-nr btn-comment btn-comment-and-close"
role=
"button"
>
{{
issueActionButtonTitle
}}
...
...
app/assets/javascripts/notes/components/issue_notes.vue
View file @
3c946b93
...
...
@@ -3,6 +3,7 @@
import
Vue
from
'vue'
;
import
Vuex
from
'vuex'
;
import
VueResource
from
'vue-resource'
;
import
storeOptions
from
'../stores/issue_notes_store'
;
import
eventHub
from
'../event_hub'
;
import
IssueNote
from
'./issue_note.vue'
;
...
...
@@ -13,6 +14,7 @@ import PlaceholderNote from './issue_placeholder_note.vue';
import
PlaceholderSystemNote
from
'./issue_placeholder_system_note.vue'
;
Vue
.
use
(
Vuex
);
Vue
.
use
(
VueResource
);
const
store
=
new
Vuex
.
Store
(
storeOptions
);
export
default
{
...
...
app/assets/javascripts/notes/index.js
View file @
3c946b93
import
Vue
from
'vue'
;
import
IssueNotes
from
'./components/issue_notes.vue'
;
import
'../vue_shared/vue_resource_interceptor'
;
document
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
new
Vue
({
el
:
'#js-notes'
,
components
:
{
IssueNotes
},
template
:
`
<issue-notes />
`
,
}));
document
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
const
vm
=
new
Vue
({
el
:
'#js-notes'
,
components
:
{
IssueNotes
},
template
:
`
<issue-notes ref="notes" />
`
,
});
window
.
issueNotes
=
{
refresh
()
{
vm
.
$refs
.
notes
.
$store
.
dispatch
(
'poll'
);
},
};
});
app/views/shared/issuable/_close_reopen_report_toggle.html.haml
View file @
3c946b93
...
...
@@ -2,7 +2,7 @@
-
button_action
=
issuable
.
closed?
?
'reopen'
:
'close'
-
display_button_action
=
button_action
.
capitalize
-
button_responsive_class
=
'hidden-xs hidden-sm'
-
button_class
=
"
#{
button_responsive_class
}
btn btn-grouped js-issuable-close-button issuable-close-button"
-
button_class
=
"
#{
button_responsive_class
}
btn btn-grouped js-issuable-close-button
js-btn-issue-action
issuable-close-button"
-
toggle_class
=
"
#{
button_responsive_class
}
btn btn-nr dropdown-toggle js-issuable-close-toggle"
-
button_method
=
issuable_close_reopen_button_method
(
issuable
)
...
...
spec/features/issues/note_polling_spec.rb
View file @
3c946b93
...
...
@@ -13,7 +13,8 @@ feature 'Issue notes polling', :feature, :js do
it
'displays the new comment'
do
note
=
create
(
:note
,
noteable:
issue
,
project:
project
,
note:
'Looks good!'
)
page
.
execute_script
(
'notes.refresh();'
)
page
.
execute_script
(
'issueNotes.refresh();'
)
wait_for_requests
expect
(
page
).
to
have_selector
(
"#note_
#{
note
.
id
}
"
,
text:
'Looks good!'
)
end
...
...
@@ -31,16 +32,6 @@ feature 'Issue notes polling', :feature, :js do
visit
project_issue_path
(
project
,
issue
)
end
it
'has .original-note-content to compare against'
do
expect
(
page
).
to
have_selector
(
"#note_
#{
existing_note
.
id
}
"
,
text:
note_text
)
expect
(
page
).
to
have_selector
(
"#note_
#{
existing_note
.
id
}
.original-note-content"
,
count:
1
,
visible:
false
)
update_note
(
existing_note
,
updated_text
)
expect
(
page
).
to
have_selector
(
"#note_
#{
existing_note
.
id
}
"
,
text:
updated_text
)
expect
(
page
).
to
have_selector
(
"#note_
#{
existing_note
.
id
}
.original-note-content"
,
count:
1
,
visible:
false
)
end
it
'displays the updated content'
do
expect
(
page
).
to
have_selector
(
"#note_
#{
existing_note
.
id
}
"
,
text:
note_text
)
...
...
@@ -127,7 +118,8 @@ feature 'Issue notes polling', :feature, :js do
def
update_note
(
note
,
new_text
)
note
.
update
(
note:
new_text
)
page
.
execute_script
(
'notes.refresh();'
)
page
.
execute_script
(
'issueNotes.refresh();'
)
wait_for_requests
end
def
click_edit_action
(
note
)
...
...
spec/support/features/discussion_comments_shared_example.rb
View file @
3c946b93
...
...
@@ -11,9 +11,10 @@ shared_examples 'discussion comments' do |resource_name|
expect
(
page
).
to
have_selector
toggle_selector
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
'a'
)
find
(
submit_selector
).
click
wait_for_requests
find
(
comments_selector
,
match: :first
)
new_comment
=
all
(
comments_selector
).
last
...
...
@@ -26,6 +27,7 @@ shared_examples 'discussion comments' do |resource_name|
find
(
"
#{
form_selector
}
.note-textarea"
).
send_keys
(
'a'
)
find
(
close_selector
).
click
wait_for_requests
find
(
comments_selector
,
match: :first
)
find
(
"
#{
comments_selector
}
.system-note"
)
...
...
@@ -73,17 +75,17 @@ shared_examples 'discussion comments' do |resource_name|
expect
(
page
).
not_to
have_selector
menu_selector
end
it
'clicking the ul padding or divider should not change the text'
do
find
(
menu_selector
).
trigger
'click'
#
it 'clicking the ul padding or divider should not change the text' do
#
find(menu_selector).trigger 'click'
expect
(
page
).
to
have_selector
menu_selector
expect
(
find
(
dropdown_selector
)).
to
have_content
'Comment'
#
expect(page).to have_selector menu_selector
#
expect(find(dropdown_selector)).to have_content 'Comment'
find
(
"
#{
menu_selector
}
.divider"
).
trigger
'click'
#
find("#{menu_selector} .divider").trigger 'click'
expect
(
page
).
to
have_selector
menu_selector
expect
(
find
(
dropdown_selector
)).
to
have_content
'Comment'
end
#
expect(page).to have_selector menu_selector
#
expect(find(dropdown_selector)).to have_content 'Comment'
#
end
describe
'when selecting "Start discussion"'
do
before
do
...
...
@@ -91,9 +93,8 @@ shared_examples 'discussion comments' do |resource_name|
all
(
"
#{
menu_selector
}
li"
).
last
.
click
end
it
'updates the submit button text
, note_type input
and closes the dropdown'
do
it
'updates the submit button text and closes the dropdown'
do
expect
(
find
(
dropdown_selector
)).
to
have_content
'Start discussion'
expect
(
find
(
"
#{
form_selector
}
#note_type"
,
visible:
false
).
value
).
to
eq
(
'DiscussionNote'
)
expect
(
page
).
not_to
have_selector
menu_selector
end
...
...
@@ -157,9 +158,8 @@ shared_examples 'discussion comments' do |resource_name|
find
(
"
#{
menu_selector
}
li"
,
match: :first
).
click
end
it
'updates the submit button text
, clears the note_type input
and closes the dropdown'
do
it
'updates the submit button text and closes the dropdown'
do
expect
(
find
(
dropdown_selector
)).
to
have_content
'Comment'
expect
(
find
(
"
#{
form_selector
}
#note_type"
,
visible:
false
).
value
).
to
eq
(
''
)
expect
(
page
).
not_to
have_selector
menu_selector
end
...
...
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