Fixes #2275 - Display name not used

This commit is contained in:
Romit Choudhary 2021-10-28 11:33:02 +02:00 committed by Mantas Masalskis
parent c422acf885
commit e7c6ea63d0
2 changed files with 17 additions and 4 deletions

View file

@ -1327,7 +1327,7 @@ class App.Utils
if type is 'email' && !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/) if type is 'email' && !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/)
e.preventDefault() e.preventDefault()
return false return false
e.attrs.label = e.attrs.value e.attrs.label ||= e.attrs.value
true true
) )
App.Delay.set(a, 500, undefined, 'tags') App.Delay.set(a, 500, undefined, 'tags')

View file

@ -17,7 +17,7 @@ RSpec.describe 'Ticket > Update > Email Reply', current_user_id: -> { current_us
it 'shows error dialog when updated value is an invalid email' do it 'shows error dialog when updated value is an invalid email' do
within(:active_content) do within(:active_content) do
click_reply click_email_reply
find('.token').double_click find('.token').double_click
find('.js-to', visible: false).sibling('.token-input').set('test') find('.js-to', visible: false).sibling('.token-input').set('test')
@ -30,7 +30,7 @@ RSpec.describe 'Ticket > Update > Email Reply', current_user_id: -> { current_us
it 'updates article when updated value is a valid email' do it 'updates article when updated value is a valid email' do
within(:active_content) do within(:active_content) do
click_reply click_email_reply
find('.token').double_click find('.token').double_click
find('.js-to', visible: false).sibling('.token-input').set('user@test.com') find('.js-to', visible: false).sibling('.token-input').set('user@test.com')
@ -43,7 +43,20 @@ RSpec.describe 'Ticket > Update > Email Reply', current_user_id: -> { current_us
end end
def click_reply context 'when a new recipient is added in email reply' do
it 'shows both name and email in token' do
click_email_reply
find('.js-to', visible: false).sibling('.token-input').set(customer.email)
find('ul.ui-autocomplete li:first-child', visible: false).click
within all('.token-label')[1] do
expect(page).to have_text("#{customer.firstname} #{customer.lastname} <#{customer.email}>")
end
end
end
def click_email_reply
click '.js-ArticleAction[data-type=emailReply]' click '.js-ArticleAction[data-type=emailReply]'
end end