Cleanup for new multiple attribute of user org selector.

This commit is contained in:
Martin Edenhofer 2016-04-25 17:46:48 +02:00
parent 190924cf4f
commit 0e5e8d0573
4 changed files with 27 additions and 31 deletions

View file

@ -274,12 +274,12 @@ class App.UiElement.ticket_selector
options =
'current_user.id': App.i18n.translateInline('current user')
'specific': App.i18n.translateInline('specific user')
#'set': App.i18n.translateInline('set')
'not_set': App.i18n.translateInline('not set (not defined)')
else if preCondition is 'org'
options =
'current_user.organization_id': App.i18n.translateInline('current user organization')
'specific': App.i18n.translateInline('specific organization')
#'set': App.i18n.translateInline('set')
'not_set': App.i18n.translateInline('not set (not defined)')
for key, value of options
selected = ''
@ -317,6 +317,12 @@ class App.UiElement.ticket_selector
if 'multiple' of config
config.multiple = true
config.nulloption = false
if config.relation is 'User'
config.multiple = false
config.nulloption = false
if config.relation is 'Organization'
config.multiple = false
config.nulloption = false
if config.tag is 'checkbox'
config.tag = 'select'
tagSearch = "#{config.tag}_search"

View file

@ -237,10 +237,10 @@ class App.UserOrganizationAutocompletion extends App.Controller
value = ''
if @attribute.multiple && @attribute.value
# fallback for if the value is not an array
if typeof @attribute.value is not 'object'
@attribute.value = [@attribute.value]
# fallback for if the value is not an array
if typeof @attribute.value isnt 'object'
@attribute.value = [@attribute.value]
value = @attribute.value.join ','
# create tokens
@ -256,7 +256,10 @@ class App.UserOrganizationAutocompletion extends App.Controller
value = @attribute.value
if value
if App.User.exists value
name = App.User.find(value).displayName()
user = App.User.find(value)
name = user.displayName()
if user.email
name += " <#{user.email}>"
else
@log 'userId doesn\'t exist', value

View file

@ -91,14 +91,8 @@ class AgentUserManageTest < TestCase
css: '.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email,
)
# check if pulldown is open, it's not working stable via selenium
@browser.execute_script( "$('.active .newTicket .js-recipientDropdown').addClass('open')" )
sleep 3
sendkey( value: :arrow_down )
sleep 0.5
click( css: '.active .newTicket .recipientList-entry.js-user.is-active' )
sleep 1

View file

@ -71,7 +71,15 @@ class TestCase < Test::Unit::TestCase
# just try again
sleep 10
log('browser_instance', { rescure: true })
begin
browser_instance_preferences(local_browser)
rescue
# just try again
sleep 10
log('browser_instance', { rescure: true })
browser_instance_preferences(local_browser)
end
end
# upload files from remote dir
@ -1383,11 +1391,6 @@ wait untill text in selector disabppears
element.send_keys(params[:customer])
sleep 2.5
# check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('#{params[:css]} .js-recipientDropdown').addClass('open')")
#sleep 0.5
element.send_keys(:arrow_down)
sleep 0.2
element.send_keys(:enter)
#instance.find_elements(css: params[:css] + ' .recipientList-entry.js-user.is-active')[0].click
sleep 0.4
@ -1721,11 +1724,6 @@ wait untill text in selector disabppears
element.send_keys(data[:customer])
sleep 2.5
# check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')")
#sleep 0.5
element.send_keys(:arrow_down)
sleep 0.2
element.send_keys(:enter)
#instance.find_elements(css: '.active .newTicket .recipientList-entry.js-user.is-active')[0].click
sleep 0.4
@ -1850,11 +1848,6 @@ wait untill text in selector disabppears
element.send_keys(data[:customer])
sleep 2.5
# check if pulldown is open, it's not working stable via selenium
#instance.execute_script("$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')")
#sleep 0.5
element.send_keys(:arrow_down)
sleep 0.4
element.send_keys(:enter)
#instance.find_elements(css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active')[0].click
sleep 0.2