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
b3fb7f5d
Commit
b3fb7f5d
authored
Oct 18, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for toggling award emoji on issue notes
parent
8989baaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
5 deletions
+41
-5
spec/features/issues/award_emoji_spec.rb
spec/features/issues/award_emoji_spec.rb
+41
-5
No files found.
spec/features/issues/award_emoji_spec.rb
View file @
b3fb7f5d
require
'rails_helper'
describe
'Awards Emoji'
,
feature:
true
do
include
WaitForAjax
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
)
}
...
...
@@ -16,20 +18,22 @@ describe 'Awards Emoji', feature: true do
project:
project
)
end
let!
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project:
issue
.
project
,
note:
"Hello world"
)
}
before
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
it
'increments the thumbsdown emoji'
,
js:
true
do
find
(
'[data-emoji="thumbsdown"]'
).
click
sleep
2
wait_for_ajax
expect
(
thumbsdown_emoji
).
to
have_text
(
"1"
)
end
context
'click the thumbsup emoji'
do
it
'increments the thumbsup emoji'
,
js:
true
do
find
(
'[data-emoji="thumbsup"]'
).
click
sleep
2
wait_for_ajax
expect
(
thumbsup_emoji
).
to
have_text
(
"1"
)
end
...
...
@@ -41,7 +45,7 @@ describe 'Awards Emoji', feature: true do
context
'click the thumbsdown emoji'
do
it
'increments the thumbsdown emoji'
,
js:
true
do
find
(
'[data-emoji="thumbsdown"]'
).
click
sleep
2
wait_for_ajax
expect
(
thumbsdown_emoji
).
to
have_text
(
"1"
)
end
...
...
@@ -49,13 +53,45 @@ describe 'Awards Emoji', feature: true do
expect
(
thumbsup_emoji
).
to
have_text
(
"0"
)
end
end
it
'toggles the smiley emoji on a note'
,
js:
true
do
toggle_smiley_emoji
(
true
)
within
(
'.note-awards'
)
do
expect
(
find
(
emoji_counter
)).
to
have_text
(
"1"
)
end
toggle_smiley_emoji
(
false
)
within
(
'.note-awards'
)
do
expect
(
page
).
not_to
have_selector
(
emoji_counter
)
end
end
end
def
thumbsup_emoji
page
.
all
(
'span.js-counter'
).
first
page
.
all
(
emoji_counter
).
first
end
def
thumbsdown_emoji
page
.
all
(
'span.js-counter'
).
last
page
.
all
(
emoji_counter
).
last
end
def
emoji_counter
'span.js-counter'
end
def
toggle_smiley_emoji
(
status
)
within
(
'.note'
)
do
find
(
'.note-emoji-button'
).
click
end
unless
status
first
(
'[data-emoji="smiley"]'
).
click
else
find
(
'[data-emoji="smiley"]'
).
click
end
wait_for_ajax
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