Commit b80df087 authored by Annabel Dunstone's avatar Annabel Dunstone

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

parent 074fa8f2
...@@ -5,7 +5,6 @@ class @AwardsHandler ...@@ -5,7 +5,6 @@ class @AwardsHandler
event.preventDefault() event.preventDefault()
@showEmojiMenu() @showEmojiMenu()
$("#emoji_search").focus()
$("html").on 'click', (event) -> $("html").on 'click', (event) ->
if !$(event.target).closest(".emoji-menu").length if !$(event.target).closest(".emoji-menu").length
...@@ -18,10 +17,12 @@ class @AwardsHandler ...@@ -18,10 +17,12 @@ class @AwardsHandler
showEmojiMenu: -> showEmojiMenu: ->
if $(".emoji-menu").length if $(".emoji-menu").length
$(".emoji-menu").show() $(".emoji-menu").show()
$("#emoji_search").focus()
else else
$.get "/emoji_menu", (response) -> $.get "/emoji_menu", (response) ->
$(".add-award").after response $(".add-award").after response
$(".emoji-menu").show() $(".emoji-menu").show()
$("#emoji_search").focus()
addAward: (emoji) -> addAward: (emoji) ->
emoji = @normilizeEmojiName(emoji) emoji = @normilizeEmojiName(emoji)
......
...@@ -96,6 +96,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps ...@@ -96,6 +96,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
end end
step 'The search field is focused' do step 'The search field is focused' do
sleep 0.8
page.evaluate_script("document.activeElement.id").should eq "emoji_search" page.evaluate_script("document.activeElement.id").should eq "emoji_search"
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment