From f54df50154817b999e6f8f7c1433abe6a4c0b282 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 27 Apr 2020 15:40:28 +0200 Subject: [PATCH] Fixes #3040: Reply Article box closes when replying multiple times and placeholder covers input. --- .../ticket_zoom/article_new.coffee | 7 ++-- spec/system/ticket/zoom_spec.rb | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 624a702cc..c63f65c72 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -141,11 +141,14 @@ class App.TicketZoomArticleNew extends App.Controller if @subscribeIdTextModule App.Ticket.unsubscribe(@subscribeIdTextModule) + @releaseGlobalClickEvents() + + releaseGlobalClickEvents: -> $(window).off 'click.ticket-zoom-select-type' - $(window).on 'click.ticket-zoom-textarea' + $(window).off 'click.ticket-zoom-textarea' render: -> - + @releaseGlobalClickEvents() ticket = App.Ticket.fullLocal(@ticket_id) @html App.view('ticket_zoom/article_new')( diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index bb585f716..fb8cedf86 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -172,4 +172,38 @@ RSpec.describe 'Ticket zoom', type: :system do end end end + + context 'replying' do + + context 'Group without signature' do + + let(:ticket) { create(:ticket) } + let(:current_user) { create(:agent_user, password: 'test', groups: [ticket.group]) } + + before do + # initial article to reply to + create(:ticket_article, ticket: ticket) + end + + it 'ensures that text input opens on multiple replies', authenticated: -> { current_user } do + visit "ticket/zoom/#{ticket.id}" + + 2.times do |article_offset| + articles_existing = 1 + articles_expected = articles_existing + (article_offset + 1) + + all('a[data-type=emailReply]').last.click + + # wait till input box expands completely + find('.attachmentPlaceholder-label').in_fixed_postion + expect(page).not_to have_css('.attachmentPlaceholder-hint', wait: 0) + + find('.articleNewEdit-body').send_keys('Some reply') + click '.js-submit' + + expect(page).to have_css('.ticket-article-item', count: articles_expected) + end + end + end + end end