Fixes #3789 - Article box opening on tickets with no changes.
This commit is contained in:
parent
497b6aaeff
commit
d638f02a12
2 changed files with 37 additions and 2 deletions
|
@ -98,7 +98,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
|||
@controllerBind('ui:rerender', =>
|
||||
@adjustedTextarea = false
|
||||
@defaults = @ui.taskGet('article')
|
||||
@attachments = @defaults.attachments
|
||||
@attachments = @defaults.attachments || []
|
||||
@render()
|
||||
)
|
||||
|
||||
|
@ -117,7 +117,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
|||
|
||||
@tokanice(@type)
|
||||
|
||||
if @defaults.body or @attachments or @isIE10()
|
||||
if @defaults.body or @attachments.length > 0 or @isIE10()
|
||||
@openTextarea(null, true)
|
||||
|
||||
tokanice: (type = 'email') ->
|
||||
|
|
|
@ -2193,4 +2193,39 @@ RSpec.describe 'Ticket zoom', type: :system do
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue