Fixes #3789 - Article box opening on tickets with no changes.

This commit is contained in:
Rolf Schmidt 2021-10-07 09:01:07 +02:00 committed by Thorsten Eckel
parent 9f9ec58230
commit a7e0d460aa
2 changed files with 37 additions and 2 deletions

View file

@ -98,7 +98,7 @@ class App.TicketZoomArticleNew extends App.Controller
@controllerBind('ui:rerender', => @controllerBind('ui:rerender', =>
@adjustedTextarea = false @adjustedTextarea = false
@defaults = @ui.taskGet('article') @defaults = @ui.taskGet('article')
@attachments = @defaults.attachments @attachments = @defaults.attachments || []
@render() @render()
) )
@ -117,7 +117,7 @@ class App.TicketZoomArticleNew extends App.Controller
@tokanice(@type) @tokanice(@type)
if @defaults.body or @attachments or @isIE10() if @defaults.body or @attachments.length > 0 or @isIE10()
@openTextarea(null, true) @openTextarea(null, true)
tokanice: (type = 'email') -> tokanice: (type = 'email') ->

View file

@ -2193,4 +2193,39 @@ RSpec.describe 'Ticket zoom', type: :system do
end end
end end
end end
context 'Article box opening on tickets with no changes #3789' do
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
before do
visit "#ticket/zoom/#{ticket.id}"
end
it 'does not expand the article box without changes' do
refresh
sleep 3
expect(page).to have_no_selector('form.article-add.is-open')
end
it 'does open and close by usage' do
find('.js-textarea').send_keys(' ')
expect(page).to have_selector('form.article-add.is-open')
find('input#global-search').click
expect(page).to have_no_selector('form.article-add.is-open')
end
it 'does open automatically when body is given from sidebar' do
find('.js-textarea').send_keys('test')
wait(5).until { Taskbar.find_by(key: "Ticket-#{ticket.id}").state.dig('article', 'body').present? }
refresh
expect(page).to have_selector('form.article-add.is-open')
end
it 'does open automatically when attachment is given from sidebar' do
page.find('input#fileUpload_1', visible: :all).set(Rails.root.join('test/data/mail/mail001.box'))
wait(5).until { Taskbar.find_by(key: "Ticket-#{ticket.id}").attributes_with_association_ids['attachments'].present? }
refresh
expect(page).to have_selector('form.article-add.is-open')
end
end
end end