summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2016-01-29 15:27:24 +0000
committerJacob Schatz <jschatz1@gmail.com>2016-01-29 15:27:24 +0000
commitb4b41b4ca6bc7cf41d0621dce670774f282f0873 (patch)
tree0e700c2242482a514853233d3ecba27727b82b84
parent227728712ec5b469a36dbaf8c9511098b4817741 (diff)
parent5a04fc90996b233a294d4f679a0cc23877f187f1 (diff)
downloadgitlab-ce-b4b41b4ca6bc7cf41d0621dce670774f282f0873.tar.gz
Merge branch 'focus-emoji-search-field' into 'master'
Auto-focus emoji award search field ![emoji-search-focus](/uploads/7cd0448e00ced19d3cf1c4fdd141c74f/emoji-search-focus.gif) Closes #12621 cc. @jschatz1 See merge request !2650
-rw-r--r--app/assets/javascripts/awards_handler.coffee1
-rw-r--r--app/views/votes/_votes_block.html.haml2
-rw-r--r--features/project/issues/award_emoji.feature3
-rw-r--r--features/steps/project/issues/award_emoji.rb4
4 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index 1ef31c7700e..047df4786a9 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -4,6 +4,7 @@ class @AwardsHandler
event.stopPropagation()
event.preventDefault()
$(".emoji-menu").show()
+ $("#emoji_search").focus()
$("html").on 'click', (event) ->
if !$(event.target).closest(".emoji-menu").length
diff --git a/app/views/votes/_votes_block.html.haml b/app/views/votes/_votes_block.html.haml
index b1f8645eea0..91c5b7eac5e 100644
--- a/app/views/votes/_votes_block.html.haml
+++ b/app/views/votes/_votes_block.html.haml
@@ -7,7 +7,7 @@
- if current_user
.awards-controls
- %a.add-award{"data-toggle" => "dropdown", "data-target" => "#", "href" => "#"}
+ %a.add-award{"href" => "#"}
= icon('smile-o')
.emoji-menu
.emoji-menu-content
diff --git a/features/project/issues/award_emoji.feature b/features/project/issues/award_emoji.feature
index 9a06fdc2ee6..bfde89fd896 100644
--- a/features/project/issues/award_emoji.feature
+++ b/features/project/issues/award_emoji.feature
@@ -9,6 +9,7 @@ Feature: Award Emoji
@javascript
Scenario: I add and remove award in the issue
Given I click to emoji-picker
+ Then The search field is focused
And I click to emoji in the picker
Then I have award added
And I can remove it by clicking to icon
@@ -16,11 +17,13 @@ Feature: Award Emoji
@javascript
Scenario: I can see the list of emoji categories
Given I click to emoji-picker
+ Then The search field is focused
Then I can see the activity and food categories
@javascript
Scenario: I can search emoji
Given I click to emoji-picker
+ Then The search field is focused
And I search "hand"
Then I see search result for "hand"
diff --git a/features/steps/project/issues/award_emoji.rb b/features/steps/project/issues/award_emoji.rb
index 2c2ed08655e..69695d493f3 100644
--- a/features/steps/project/issues/award_emoji.rb
+++ b/features/steps/project/issues/award_emoji.rb
@@ -66,4 +66,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
expect(page).to have_selector '[data-emoji="raised_hand"]'
end
end
+
+ step 'The search field is focused' do
+ page.evaluate_script("document.activeElement.id").should eq "emoji_search"
+ end
end