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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
44876032
Commit
44876032
authored
Apr 01, 2016
by
Phil Hughes
Committed by
Fatih Acet
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for issues
parent
797acde0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
3 deletions
+143
-3
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+3
-3
spec/features/issues/award_spec.rb
spec/features/issues/award_spec.rb
+140
-0
No files found.
app/views/projects/notes/_note.html.haml
View file @
44876032
...
...
@@ -9,13 +9,13 @@
=
image_tag
avatar_icon
(
note
.
author
),
alt:
''
,
class:
'avatar s40'
.timeline-content
.note-header
-
if
note_editable?
(
note
)
.note-actions
.note-actions
-
if
current_user
.award-menu-holder.note-action-award-holder.js-award-holder.js-award-action-btn
{
data:
{
target:
"##{dom_id(note)} .js-awards-block"
}
}
=
link_to
'#'
,
title:
'Award emoji'
,
class:
'note-award-control js-add-award'
,
data:
{
award_menu_url:
emojis_path
}
do
=
icon
(
'smile-o'
,
{
class:
"award-control-icon award-control-icon-normal"
})
=
icon
(
'spinner spin'
,
{
class:
"award-control-icon award-control-icon-loading"
})
-
if
note_editable?
(
note
)
=
link_to
'#'
,
title:
'Edit comment'
,
class:
'js-note-edit'
do
=
icon
(
'pencil-square-o'
)
...
...
spec/features/issues/award_spec.rb
0 → 100644
View file @
44876032
require
'rails_helper'
feature
'Issue awards'
,
js:
true
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:note
)
{
create
(
:note_on_issue
,
project:
project
,
noteable:
issue
,
note:
'Looks good!'
)
}
describe
'logged in'
do
before
do
login_as
(
user
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
it
'should add award to issue'
do
first
(
'.js-emoji-btn'
).
click
expect
(
page
).
to
have_selector
(
'.js-emoji-btn.active'
)
expect
(
first
(
'.js-emoji-btn'
)).
to
have_content
'1'
end
it
'should remove award from issue'
do
first
(
'.js-emoji-btn'
).
click
find
(
'.js-emoji-btn.active'
).
click
expect
(
first
(
'.js-emoji-btn'
)).
to
have_content
'0'
end
it
'should show award menu button in notes'
do
page
.
within
(
'.note'
)
do
expect
(
page
).
to
have_selector
(
'.js-award-action-btn'
)
end
end
it
'should not show award bar on note if no awards given'
do
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
be_visible
end
end
it
'should be able to show award menu when clicking add award button in note'
do
show_note_award_menu
end
it
'should only have one menu on the page'
do
first
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
)
page
.
within
(
'.note'
)
do
find
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
,
count:
1
)
end
end
it
'should add award to note'
do
show_note_award_menu
award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
end
it
'should remove award from note'
do
show_note_award_menu
award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
remove_award_on_note
sleep
0.5
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
be_visible
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
have_selector
(
'.active'
)
end
end
it
'should not hide award bar on notes with more than 1 award'
do
show_note_award_menu
award_on_note
show_note_award_menu
award_on_note
(
2
)
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
remove_award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
end
end
end
describe
'logged out'
do
before
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
it
'should not see award menu button'
do
expect
(
page
).
not_to
have_selector
(
'.js-award-holder'
)
end
it
'should not see award menu button in note'
do
page
.
within
(
'.note'
)
do
expect
(
page
).
not_to
have_selector
(
'.js-award-action-btn'
)
end
end
end
def
show_note_award_menu
page
.
within
(
'.note'
)
do
find
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
)
end
end
def
award_on_note
(
index
=
1
)
page
.
within
(
'.note'
)
do
page
.
within
(
'.emoji-menu'
)
do
buttons
=
all
(
'.js-emoji-btn'
)
buttons
[
index
].
click
end
end
end
def
remove_award_on_note
page
.
within
(
'.note'
)
do
page
.
within
(
'.js-awards-block'
)
do
first
(
'.js-emoji-btn'
).
click
end
end
end
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