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
Boxiang Sun
gitlab-ce
Commits
6968ea32
Commit
6968ea32
authored
Mar 11, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'award-emoji-design-update' into 'master'
Updated UI of award emoji Closes #13878 See merge request !3028
parents
5a84e838
25f392ea
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
201 additions
and
164 deletions
+201
-164
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+52
-25
app/assets/stylesheets/framework/blocks.scss
app/assets/stylesheets/framework/blocks.scss
+4
-0
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+7
-0
app/assets/stylesheets/pages/awards.scss
app/assets/stylesheets/pages/awards.scss
+109
-101
app/views/emojis/index.html.haml
app/views/emojis/index.html.haml
+6
-4
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-1
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+8
-19
features/steps/project/issues/award_emoji.rb
features/steps/project/issues/award_emoji.rb
+13
-13
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
6968ea32
class
@
AwardsHandler
class
@
AwardsHandler
constructor
:
(
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
aliases
)
->
constructor
:
(
@
post_emoji_url
,
@
noteable_type
,
@
noteable_id
,
@
aliases
)
->
$
(
".
add-award"
).
click
(
event
)
=>
$
(
".
js-add-award"
).
on
"click"
,
(
event
)
=>
event
.
stopPropagation
()
event
.
stopPropagation
()
event
.
preventDefault
()
event
.
preventDefault
()
...
@@ -9,27 +9,46 @@ class @AwardsHandler
...
@@ -9,27 +9,46 @@ class @AwardsHandler
$
(
"html"
).
on
'click'
,
(
event
)
->
$
(
"html"
).
on
'click'
,
(
event
)
->
if
!
$
(
event
.
target
).
closest
(
".emoji-menu"
).
length
if
!
$
(
event
.
target
).
closest
(
".emoji-menu"
).
length
if
$
(
".emoji-menu"
).
is
(
":visible"
)
if
$
(
".emoji-menu"
).
is
(
":visible"
)
$
(
".emoji-menu"
).
hide
()
$
(
".emoji-menu"
).
removeClass
"is-visible"
$
(
".awards"
)
.
off
"click"
.
on
"click"
,
".js-emoji-btn"
,
@
handleClick
@
renderFrequentlyUsedBlock
()
@
renderFrequentlyUsedBlock
()
@
setupSearch
()
handleClick
:
(
e
)
->
e
.
preventDefault
()
emoji
=
$
(
this
)
.
find
(
".icon"
)
.
data
"emoji"
awards_handler
.
addAward
emoji
showEmojiMenu
:
->
showEmojiMenu
:
->
if
$
(
".emoji-menu"
).
length
if
$
(
".emoji-menu"
).
length
$
(
".emoji-menu"
).
show
()
if
$
(
".emoji-menu"
).
is
".is-visible"
$
(
"#emoji_search"
).
focus
()
$
(
".emoji-menu"
).
removeClass
"is-visible"
else
$
(
"#emoji_search"
).
blur
()
$
.
get
"/emojis"
,
(
response
)
->
else
$
(
".add-award"
).
after
response
$
(
".emoji-menu"
).
addClass
"is-visible"
$
(
".emoji-menu"
).
show
()
$
(
"#emoji_search"
).
focus
()
$
(
"#emoji_search"
).
focus
()
else
$
(
'.js-add-award'
).
addClass
"is-loading"
$
.
get
"/emojis"
,
(
response
)
=>
$
(
'.js-add-award'
).
removeClass
"is-loading"
$
(
".js-award-holder"
).
append
response
setTimeout
=>
$
(
".emoji-menu"
).
addClass
"is-visible"
$
(
"#emoji_search"
).
focus
()
@
setupSearch
()
,
200
addAward
:
(
emoji
)
->
addAward
:
(
emoji
)
->
emoji
=
@
normilizeEmojiName
(
emoji
)
emoji
=
@
normilizeEmojiName
(
emoji
)
@
postEmoji
emoji
,
=>
@
postEmoji
emoji
,
=>
@
addAwardToEmojiBar
(
emoji
)
@
addAwardToEmojiBar
(
emoji
)
$
(
".emoji-menu"
).
hide
()
$
(
".emoji-menu"
).
removeClass
"is-visible"
addAwardToEmojiBar
:
(
emoji
)
->
addAwardToEmojiBar
:
(
emoji
)
->
@
addEmojiToFrequentlyUsedList
(
emoji
)
@
addEmojiToFrequentlyUsedList
(
emoji
)
...
@@ -39,7 +58,7 @@ class @AwardsHandler
...
@@ -39,7 +58,7 @@ class @AwardsHandler
if
@
isActive
(
emoji
)
if
@
isActive
(
emoji
)
@
decrementCounter
(
emoji
)
@
decrementCounter
(
emoji
)
else
else
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".counter"
)
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".
js-
counter"
)
counter
.
text
(
parseInt
(
counter
.
text
())
+
1
)
counter
.
text
(
parseInt
(
counter
.
text
())
+
1
)
counter
.
parent
().
addClass
(
"active"
)
counter
.
parent
().
addClass
(
"active"
)
@
addMeToAuthorList
(
emoji
)
@
addMeToAuthorList
(
emoji
)
...
@@ -53,7 +72,7 @@ class @AwardsHandler
...
@@ -53,7 +72,7 @@ class @AwardsHandler
@
findEmojiIcon
(
emoji
).
parent
().
hasClass
(
"active"
)
@
findEmojiIcon
(
emoji
).
parent
().
hasClass
(
"active"
)
decrementCounter
:
(
emoji
)
->
decrementCounter
:
(
emoji
)
->
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".counter"
)
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".
js-
counter"
)
emojiIcon
=
counter
.
parent
()
emojiIcon
=
counter
.
parent
()
if
parseInt
(
counter
.
text
())
>
1
if
parseInt
(
counter
.
text
())
>
1
counter
.
text
(
parseInt
(
counter
.
text
())
-
1
)
counter
.
text
(
parseInt
(
counter
.
text
())
-
1
)
...
@@ -70,9 +89,13 @@ class @AwardsHandler
...
@@ -70,9 +89,13 @@ class @AwardsHandler
removeMeFromAuthorList
:
(
emoji
)
->
removeMeFromAuthorList
:
(
emoji
)
->
award_block
=
@
findEmojiIcon
(
emoji
).
parent
()
award_block
=
@
findEmojiIcon
(
emoji
).
parent
()
authors
=
award_block
.
attr
(
"data-original-title"
).
split
(
", "
)
authors
=
award_block
.
attr
(
"data-original-title"
)
.
split
(
", "
)
authors
.
splice
(
authors
.
indexOf
(
"me"
),
1
)
authors
.
splice
(
authors
.
indexOf
(
"me"
),
1
)
award_block
.
closest
(
".award"
).
attr
(
"data-original-title"
,
authors
.
join
(
", "
))
award_block
.
closest
(
".js-emoji-btn"
)
.
attr
(
"data-original-title"
,
authors
.
join
(
", "
))
@
resetTooltip
(
award_block
)
@
resetTooltip
(
award_block
)
addMeToAuthorList
:
(
emoji
)
->
addMeToAuthorList
:
(
emoji
)
->
...
@@ -98,14 +121,18 @@ class @AwardsHandler
...
@@ -98,14 +121,18 @@ class @AwardsHandler
emojiCssClass
=
@
resolveNameToCssClass
(
emoji
)
emojiCssClass
=
@
resolveNameToCssClass
(
emoji
)
nodes
=
[]
nodes
=
[]
nodes
.
push
(
"<div class='award active' title='me'>"
)
nodes
.
push
(
nodes
.
push
(
"<div class='icon emoji-icon
#{
emojiCssClass
}
' data-emoji='
#{
emoji
}
'></div>"
)
"<button class='btn award-control js-emoji-btn has_tooltip active' title='me'>"
,
nodes
.
push
(
"<div class='counter'>1</div>"
)
"<div class='icon emoji-icon
#{
emojiCssClass
}
' data-emoji='
#{
emoji
}
'></div>"
,
nodes
.
push
(
"</div>"
)
"<span class='award-control-text js-counter'>1</span>"
,
"</button>"
emoji_node
=
$
(
nodes
.
join
(
"
\n
"
)).
insertBefore
(
".awards-controls"
).
find
(
".emoji-icon"
).
data
(
"emoji"
,
emoji
)
)
$
(
".award"
).
tooltip
()
emoji_node
=
$
(
nodes
.
join
(
"
\n
"
))
.
insertBefore
(
".js-award-holder"
)
.
find
(
".emoji-icon"
)
.
data
(
"emoji"
,
emoji
)
$
(
'.award-control'
).
tooltip
()
resolveNameToCssClass
:
(
emoji
)
->
resolveNameToCssClass
:
(
emoji
)
->
emoji_icon
=
$
(
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
)
emoji_icon
=
$
(
".emoji-menu-content [data-emoji='
#{
emoji
}
']"
)
...
@@ -128,7 +155,7 @@ class @AwardsHandler
...
@@ -128,7 +155,7 @@ class @AwardsHandler
callback
.
call
()
callback
.
call
()
findEmojiIcon
:
(
emoji
)
->
findEmojiIcon
:
(
emoji
)
->
$
(
".award [data-emoji='
#{
emoji
}
']"
)
$
(
".award
s > .js-emoji-btn
[data-emoji='
#{
emoji
}
']"
)
scrollToAwards
:
->
scrollToAwards
:
->
$
(
'body, html'
).
animate
({
$
(
'body, html'
).
animate
({
...
@@ -164,13 +191,13 @@ class @AwardsHandler
...
@@ -164,13 +191,13 @@ class @AwardsHandler
term
=
$
(
ev
.
target
).
val
()
term
=
$
(
ev
.
target
).
val
()
# Clean previous search results
# Clean previous search results
$
(
"ul.emoji-
search,
h5.emoji-search"
).
remove
()
$
(
"ul.emoji-
menu-search,
h5.emoji-search"
).
remove
()
if
term
if
term
# Generate a search result block
# Generate a search result block
h5
=
$
(
"<h5>"
).
text
(
"Search results"
).
addClass
(
"emoji-search"
)
h5
=
$
(
"<h5>"
).
text
(
"Search results"
).
addClass
(
"emoji-search"
)
found_emojis
=
@
searchEmojis
(
term
).
show
()
found_emojis
=
@
searchEmojis
(
term
).
show
()
ul
=
$
(
"<ul>"
).
addClass
(
"emoji-search"
).
append
(
found_emojis
)
ul
=
$
(
"<ul>"
).
addClass
(
"emoji-
menu-list emoji-menu-
search"
).
append
(
found_emojis
)
$
(
".emoji-menu-content ul, .emoji-menu-content h5"
).
hide
()
$
(
".emoji-menu-content ul, .emoji-menu-content h5"
).
hide
()
$
(
".emoji-menu-content"
).
append
(
h5
).
append
(
ul
)
$
(
".emoji-menu-content"
).
append
(
h5
).
append
(
ul
)
else
else
...
...
app/assets/stylesheets/framework/blocks.scss
View file @
6968ea32
...
@@ -157,3 +157,7 @@
...
@@ -157,3 +157,7 @@
float
:
right
;
float
:
right
;
}
}
}
}
.content-block-small
{
padding
:
10px
0
;
}
app/assets/stylesheets/framework/variables.scss
View file @
6968ea32
...
@@ -152,3 +152,10 @@ $dropdown-toggle-border-color: #EAEAEA;
...
@@ -152,3 +152,10 @@ $dropdown-toggle-border-color: #EAEAEA;
$dropdown-toggle-hover-border-color
:
darken
(
$dropdown-toggle-border-color
,
15%
);
$dropdown-toggle-hover-border-color
:
darken
(
$dropdown-toggle-border-color
,
15%
);
$dropdown-toggle-icon-color
:
#C4C4C4
;
$dropdown-toggle-icon-color
:
#C4C4C4
;
$dropdown-toggle-hover-icon-color
:
$dropdown-toggle-hover-border-color
;
$dropdown-toggle-hover-icon-color
:
$dropdown-toggle-hover-border-color
;
/*
* Award emoji
*/
$award-emoji-menu-bg
:
#FFF
;
$award-emoji-menu-border
:
#F1F2F4
;
$award-emoji-new-btn-icon-color
:
#DCDCDC
;
app/assets/stylesheets/pages/awards.scss
View file @
6968ea32
.awards
{
.awards
{
@include
clearfix
;
line-height
:
34px
;
line-height
:
34px
;
.emoji-icon
{
.emoji-icon
{
width
:
20px
;
width
:
20px
;
height
:
20px
;
height
:
20px
;
margin
:
7px
0
0
5px
;
}
}
}
.award
{
.emoji-menu
{
@include
border-radius
(
5px
);
position
:
absolute
;
top
:
100%
;
border
:
1px
solid
;
left
:
0
;
padding
:
0px
10px
;
margin-top
:
3px
;
float
:
left
;
z-index
:
1000
;
margin-right
:
5px
;
min-width
:
160px
;
border-color
:
$border-color
;
font-size
:
14px
;
cursor
:
pointer
;
background-color
:
$award-emoji-menu-bg
;
border
:
1px
solid
$award-emoji-menu-border
;
border-radius
:
$border-radius-base
;
box-shadow
:
0
6px
12px
rgba
(
0
,
0
,
0
,.
175
);
pointer-events
:
none
;
opacity
:
0
;
transform
:
scale
(
.2
);
transform-origin
:
0
-45px
;
transition
:
all
.3s
cubic-bezier
(
.87
,-.
41
,.
19
,
1
.44
);
&
.is-visible
{
pointer-events
:
all
;
opacity
:
1
;
transform
:
scale
(
1
);
}
&
:hover
{
.emoji-menu-content
{
background-color
:
#dce0e5
;
padding
:
$gl-padding
;
width
:
300px
;
height
:
300px
;
overflow-y
:
scroll
;
input
.emoji-search
{
background-image
:
url("data:image/png;base64,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")
;
background-repeat
:
no-repeat
;
background-position
:
right
5px
center
;
background-size
:
16px
;
}
}
}
}
&
.active
{
.emoji-menu-list
{
border-color
:
$border-gray-light
;
list-style
:
none
;
background-color
:
$gray-light
;
padding-left
:
0
;
margin-bottom
:
0
;
&
:hover
{
}
background-color
:
#dce0e5
;
}
.counter
{
.emoji-menu-list-item
{
font-weight
:
bold
;
padding
:
3px
;
}
margin-left
:
1px
;
}
margin-right
:
1px
;
}
.icon
{
.emoji-menu-btn
{
float
:
left
;
display
:
block
;
margin-right
:
10px
;
cursor
:
pointer
;
}
width
:
30px
;
height
:
30px
;
padding
:
0
;
background
:
none
;
border
:
0
;
border-radius
:
$border-radius-base
;
transition
:
transform
.15s
cubic-bezier
(
.3
,
0
,
.2
,
2
);
&
:hover
{
background-color
:
transparent
;
outline
:
0
;
transform
:
scale
(
1
.3
);
}
.counter
{
&
:focus
,
float
:
left
;
&
:active
{
}
outline
:
0
;
}
}
.awards-controls
{
.emoji-icon
{
display
:
inline-block
;
position
:
relative
;
position
:
relative
;
margin-left
:
10px
;
top
:
3px
;
float
:
left
;
}
}
.add-award
{
.award-menu-holder
{
font-size
:
24px
;
display
:
inline-block
;
color
:
$gl-gray
;
position
:
relative
;
position
:
relative
;
}
top
:
2px
;
&
:hover
,
.award-control
{
&
:link
{
margin-right
:
5px
;
text-decoration
:
none
;
padding-left
:
5px
;
}
padding-right
:
5px
;
}
line-height
:
20px
;
outline
:
0
;
&
.active
,
&
:active
{
background-color
:
$white-dark
;
box-shadow
:
none
;
outline
:
0
;
}
.emoji-menu
{
&
.is-loading
{
position
:
absolute
;
.award-control-icon
{
top
:
100%
;
left
:
0
;
z-index
:
1000
;
display
:
none
;
display
:
none
;
float
:
left
;
min-width
:
160px
;
padding
:
5px
0
;
margin
:
2px
0
0
;
font-size
:
14px
;
text-align
:
left
;
list-style
:
none
;
background-color
:
#fff
;
-webkit-background-clip
:
padding-box
;
background-clip
:
padding-box
;
border
:
1px
solid
#ccc
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,.
15
);
border-radius
:
4px
;
-webkit-box-shadow
:
0
6px
12px
rgba
(
0
,
0
,
0
,.
175
);
box-shadow
:
0
6px
12px
rgba
(
0
,
0
,
0
,.
175
);
.emoji-menu-content
{
padding
:
$gl-padding
;
width
:
300px
;
height
:
300px
;
overflow-y
:
scroll
;
h5
{
clear
:
left
;
}
ul
{
list-style-type
:
none
;
margin-left
:
-20px
;
margin-bottom
:
20px
;
overflow
:
auto
;
}
input
.emoji-search
{
background
:
image-url
(
"icon-search.png"
)
240px
no-repeat
;
}
li
{
cursor
:
pointer
;
width
:
30px
;
height
:
30px
;
text-align
:
center
;
float
:
left
;
margin
:
3px
;
list-decorate
:
none
;
@include
border-radius
(
5px
);
&
:hover
{
background-color
:
#ccc
;
}
}
}
}
}
.award-control-icon-loading
{
display
:
block
;
}
}
.icon
,
.award-control-icon
{
float
:
left
;
margin-right
:
5px
;
font-size
:
20px
;
}
.award-control-icon-loading
{
display
:
none
;
}
.award-control-icon
{
color
:
$award-emoji-new-btn-icon-color
;
}
}
}
}
app/views/emojis/index.html.haml
View file @
6968ea32
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
.emoji-menu-content
.emoji-menu-content
=
text_field_tag
:emoji_search
,
""
,
class:
"emoji-search search-input form-control"
=
text_field_tag
:emoji_search
,
""
,
class:
"emoji-search search-input form-control"
-
AwardEmoji
.
emoji_by_category
.
each
do
|
category
,
emojis
|
-
AwardEmoji
.
emoji_by_category
.
each
do
|
category
,
emojis
|
%h5
=
AwardEmoji
::
CATEGORIES
[
category
]
%h5
.emoji-menu-title
%ul
=
AwardEmoji
::
CATEGORIES
[
category
]
%ul
.clearfix.emoji-menu-list
-
emojis
.
each
do
|
emoji
|
-
emojis
.
each
do
|
emoji
|
%li
%li
.pull-left.text-center.emoji-menu-list-item
=
emoji_icon
(
emoji
[
"name"
],
emoji
[
"unicode"
],
emoji
[
"aliases"
])
%button
.emoji-menu-btn.text-center.js-emoji-btn
{
type:
"button"
}
\ No newline at end of file
=
emoji_icon
(
emoji
[
"name"
],
emoji
[
"unicode"
],
emoji
[
"aliases"
])
app/views/projects/issues/show.html.haml
View file @
6968ea32
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
.merge-requests
.merge-requests
=
render
'merge_requests'
=
render
'merge_requests'
.content-block
.content-block
.content-block-small
=
render
'votes/votes_block'
,
votable:
@issue
=
render
'votes/votes_block'
,
votable:
@issue
.row
.row
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
6968ea32
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
.tab-content
.tab-content
#notes
.notes.tab-pane.voting_notes
#notes
.notes.tab-pane.voting_notes
.content-block.oneline-block
.content-block.
content-block-small.
oneline-block
=
render
'votes/votes_block'
,
votable:
@merge_request
=
render
'votes/votes_block'
,
votable:
@merge_request
.row
.row
...
...
app/views/votes/_votes_block.html.haml
View file @
6968ea32
.awards.votes-block
.awards.votes-block
-
awards_sort
(
votable
.
notes
.
awards
.
grouped_awards
).
each
do
|
emoji
,
notes
|
-
awards_sort
(
votable
.
notes
.
awards
.
grouped_awards
).
each
do
|
emoji
,
notes
|
.award
{
class:
(
note_active_class
(
notes
,
current_user
)),
title:
emoji_author_list
(
notes
,
current_user
)
}
%button
.btn.award-control.js-emoji-btn.has_tooltip
{
class:
(
note_active_class
(
notes
,
current_user
)),
title:
emoji_author_list
(
notes
,
current_user
),
data:
{
placement:
"top"
}
}
=
emoji_icon
(
emoji
)
=
emoji_icon
(
emoji
)
.
counter
%span
.award-control-text.js-
counter
=
notes
.
count
=
notes
.
count
-
if
current_user
-
if
current_user
.awards-controls
%div
.award-menu-holder.js-award-holder
%a
.add-award
{
"href"
=>
"#"
}
%a
.btn.award-control.js-add-award
{
"href"
=>
"#"
}
=
icon
(
'smile-o'
)
=
icon
(
'smile-o'
,
{
class:
"award-control-icon"
})
=
icon
(
'spinner spin'
,
{
class:
"award-control-icon award-control-icon-loading"
})
%span
.award-control-text
Add
-
if
current_user
-
if
current_user
:javascript
:javascript
...
@@ -23,17 +26,3 @@
...
@@ -23,17 +26,3 @@
noteable_id
,
noteable_id
,
aliases
aliases
);
);
$
(
"
.awards
"
).
on
(
"
click
"
,
"
.emoji-menu-content li
"
,
function
(
e
)
{
var
emoji
=
$
(
this
).
find
(
"
.emoji-icon
"
).
data
(
"
emoji
"
);
awards_handler
.
addAward
(
emoji
);
});
$
(
"
.awards
"
).
on
(
"
click
"
,
"
.award
"
,
function
(
e
)
{
var
emoji
=
$
(
this
).
find
(
"
.icon
"
).
data
(
"
emoji
"
);
awards_handler
.
addAward
(
emoji
);
});
$
(
"
.award
"
).
tooltip
();
$
(
"
.emoji-menu-content
"
).
niceScroll
({
cursorwidth
:
"
7px
"
,
autohidemode
:
false
});
features/steps/project/issues/award_emoji.rb
View file @
6968ea32
...
@@ -10,7 +10,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
...
@@ -10,7 +10,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
step
'I click the thumbsup award Emoji'
do
step
'I click the thumbsup award Emoji'
do
page
.
within
'.awards'
do
page
.
within
'.awards'
do
thumbsup
=
page
.
fi
nd
(
'.award .emoji-1F44D
'
)
thumbsup
=
page
.
fi
rst
(
'.award-control
'
)
thumbsup
.
click
thumbsup
.
click
thumbsup
.
hover
thumbsup
.
hover
sleep
0.3
sleep
0.3
...
@@ -18,23 +18,23 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
...
@@ -18,23 +18,23 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
end
end
step
'I click to emoji-picker'
do
step
'I click to emoji-picker'
do
page
.
within
'.awards
-controls
'
do
page
.
within
'.awards'
do
page
.
find
(
'.add-award'
).
click
page
.
find
(
'.
js-
add-award'
).
click
end
end
end
end
step
'I click to emoji in the picker'
do
step
'I click to emoji in the picker'
do
page
.
within
'.emoji-menu-content'
do
page
.
within
'.emoji-menu-content'
do
page
.
first
(
'.
emoji-ico
n'
).
click
page
.
first
(
'.
js-emoji-bt
n'
).
click
end
end
end
end
step
'I can remove it by clicking to icon'
do
step
'I can remove it by clicking to icon'
do
page
.
within
'.awards'
do
page
.
within
'.awards'
do
expect
do
expect
do
page
.
find
(
'.
award
.active'
).
click
page
.
find
(
'.
js-emoji-btn
.active'
).
click
sleep
0.3
sleep
0.3
end
.
to
change
{
page
.
all
(
".award"
).
size
}.
from
(
3
).
to
(
2
)
end
.
to
change
{
page
.
all
(
".award
-control.js-emoji-btn
"
).
size
}.
from
(
3
).
to
(
2
)
end
end
end
end
...
@@ -49,23 +49,23 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
...
@@ -49,23 +49,23 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
sleep
0.2
sleep
0.2
page
.
within
'.awards'
do
page
.
within
'.awards'
do
expect
(
page
).
to
have_selector
'.
award
'
expect
(
page
).
to
have_selector
'.
js-emoji-btn
'
expect
(
page
.
find
(
'.
award.active .
counter'
)).
to
have_content
'1'
expect
(
page
.
find
(
'.
js-emoji-btn.active .js-
counter'
)).
to
have_content
'1'
expect
(
page
.
find
(
'.
award
.active'
)[
'data-original-title'
]).
to
eq
(
'me'
)
expect
(
page
.
find
(
'.
js-emoji-btn
.active'
)[
'data-original-title'
]).
to
eq
(
'me'
)
end
end
end
end
step
'I have no awards added'
do
step
'I have no awards added'
do
page
.
within
'.awards'
do
page
.
within
'.awards'
do
expect
(
page
).
to
have_selector
'.award'
expect
(
page
).
to
have_selector
'.award
-control.js-emoji-btn
'
expect
(
page
.
all
(
'.award'
).
size
).
to
eq
(
2
)
expect
(
page
.
all
(
'.award
-control.js-emoji-btn
'
).
size
).
to
eq
(
2
)
# Check tooltip data
# Check tooltip data
page
.
all
(
'.award'
).
each
do
|
element
|
page
.
all
(
'.award
-control.js-emoji-btn
'
).
each
do
|
element
|
expect
(
element
[
'title'
]).
to
eq
(
""
)
expect
(
element
[
'title'
]).
to
eq
(
""
)
end
end
page
.
all
(
'.award
.
counter'
).
each
do
|
element
|
page
.
all
(
'.award
-control .js-
counter'
).
each
do
|
element
|
expect
(
element
).
to
have_content
'0'
expect
(
element
).
to
have_content
'0'
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