Fixed "empty" global search box on "x".

This commit is contained in:
Martin Edenhofer 2015-01-01 00:38:56 +01:00
parent 47e637b839
commit f91bf9d304
5 changed files with 35 additions and 47 deletions

View file

@ -200,10 +200,9 @@ class App.Navigation extends App.Controller
# remove search result
@$('#global-search').bind( 'focusout', (e) =>
@$('.search').removeClass('focused')
@delay(
=>
@$('.search').removeClass('focused')
@renderResult()
320
)

View file

@ -21,6 +21,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
@el
open: =>
@clearDelay('close')
@el.addClass('open')
@catcher = new App.clickCatcher
holder: @el.offsetParent()

View file

@ -55,23 +55,8 @@ class AgentTicketActionsLevel2Test < TestCase
# open ticket in second browser
{
:where => :instance2,
:execute => 'set',
:css => '#global-search',
:value => '###stack###',
},
{
:execute => 'wait',
:value => 3,
},
{
:where => :instance2,
:execute => 'click',
:link => '###stack###',
# :css => 'a:contains(\'###stack###\')',
},
{
:execute => 'wait',
:value => 3,
:execute => 'search_ticket',
:number => '###stack###',
},
{
:where => :instance2,

View file

@ -53,29 +53,10 @@ class AgentTicketActionsLevel3Test < TestCase
},
# open ticket in second browser
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'set',
:css => '#global-search',
:value => '###stack###',
},
{
:execute => 'wait',
:value => 3,
},
{
:where => :instance2,
:execute => 'click',
:link => '###stack###',
# :css => 'a:contains(\'###stack###\')',
},
{
:execute => 'wait',
:value => 3,
:execute => 'search_ticket',
:number => '###stack###',
},
{
:where => :instance2,

View file

@ -262,7 +262,7 @@ class TestCase < Test::Unit::TestCase
(1..loops).each { |loop|
element = instance.find_elements( { :css => action[:area] } )[0]
if element #&& element.displayed?
text = instance.find_elements( { :css => action[:area] } )[0].text
text = element.text
if text =~ /#{action[:value]}/i
assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
return
@ -412,13 +412,7 @@ class TestCase < Test::Unit::TestCase
element = instance.find_elements( { :css => '.active .newTicket input[name="customer_id_completion"]' } )[0]
element.click
element.clear
# in certan cases focus is not set, do it this way
#instance.execute_script( '$(".content.active .newTicket input[name=customer_id_completion]").focus()' )
element.send_keys( :tab )
element.click
element.send_keys( 'nico*' )
sleep 0.5
sleep 4
element.send_keys( :arrow_down )
sleep 0.1
@ -443,6 +437,34 @@ class TestCase < Test::Unit::TestCase
}
assert( false, "(#{test[:name]}) ticket creation failed, can't get zoom url" )
return
elsif action[:execute] == 'search_ticket'
element = instance.find_elements( { :css => '#global-search' } )[0]
element.click
element.clear
action[:number].gsub! '###stack###', @stack
element.send_keys( action[:number] )
sleep 3
instance.find_elements( { :css => '.search .empty-search' } )[0].click
sleep 0.5
text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value')
if !text
assert( false, "(#{test[:name]}) #global-search is not empty!" )
return
end
element = instance.find_elements( { :css => '#global-search' } )[0]
element.click
element.clear
action[:number].gsub! '###stack###', @stack
element.send_keys( action[:number] )
sleep 3
element = instance.find_element( { :partial_link_text => action[:number] } ).click
number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text
if number !~ /#{action[:number]}/
assert( false, "(#{test[:name]}) unable to search/find ticket #{action[:number]}!" )
return
end
assert( true, "(#{test[:name]}) ticket #{action[:number]} found" )
return
elsif action[:execute] == 'close_all_tasks'
for i in 1..100
sleep 1