Просмотр исходного кода

Fixes: Mobile - Remove signature, if group is deselected

Vladimir Sheremet 2 лет назад
Родитель
Сommit
65d957225d

+ 4 - 1
app/frontend/shared/composables/useTicketSignature.ts

@@ -68,7 +68,10 @@ export const useTicketSignature = (ticket?: Ref<TicketById | undefined>) => {
 
 
       const groupId = getValue(values, changedField, 'group_id')
       const groupId = getValue(values, changedField, 'group_id')
 
 
-      if (!groupId) return
+      if (!groupId) {
+        editorContext.removeSignature()
+        return
+      }
 
 
       const senderType = getValue(values, changedField, 'articleSenderType')
       const senderType = getValue(values, changedField, 'articleSenderType')
 
 

+ 23 - 0
spec/system/apps/mobile/tickets/ticket_create_spec.rb

@@ -181,6 +181,29 @@ RSpec.describe 'Mobile > Ticket > Create', app: :mobile, authenticated_as: :user
         expect(find_editor('Text')).to have_text_value('', exact: true)
         expect(find_editor('Text')).to have_text_value('', exact: true)
       end
       end
     end
     end
+
+    it 'removes signature when group is deselected' do
+      within_form(form_updater_gql_number: 1) do
+        find_input('Title').type(Faker::Name.name_with_middle)
+        next_step
+
+        find_radio('articleSenderType').select_choice('Send Email')
+        next_step
+
+        find_select('Group').select_option('Users')
+        next_step
+
+        expect(find_editor('Text')).to have_text_value(user.fullname)
+
+        go_to_step(3)
+        find_select('Group').clear_selection
+
+        go_to_step(4)
+
+        # only label is rendered as text
+        expect(find_editor('Text')).to have_text_value('', exact: true)
+      end
+    end
   end
   end
 
 
   context 'with entered form fields' do
   context 'with entered form fields' do