Add timeout for ajax call in award emoji steps; update focus in award picker

This commit is contained in:
Annabel Dunstone 2016-02-19 07:32:20 -06:00
parent 074fa8f2b9
commit b80df08735
2 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,6 @@ class @AwardsHandler
event.preventDefault()
@showEmojiMenu()
$("#emoji_search").focus()
$("html").on 'click', (event) ->
if !$(event.target).closest(".emoji-menu").length
@ -18,10 +17,12 @@ class @AwardsHandler
showEmojiMenu: ->
if $(".emoji-menu").length
$(".emoji-menu").show()
$("#emoji_search").focus()
else
$.get "/emoji_menu", (response) ->
$(".add-award").after response
$(".emoji-menu").show()
$("#emoji_search").focus()
addAward: (emoji) ->
emoji = @normilizeEmojiName(emoji)

View File

@ -96,6 +96,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
end
step 'The search field is focused' do
sleep 0.8
page.evaluate_script("document.activeElement.id").should eq "emoji_search"
end
end