From 57c1124a42bcc92d31576a283c6c436024aec779 Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Tue, 8 May 2018 09:46:28 +0300 Subject: [PATCH] Fixed issue #1770 - Owner reset after group selection (#1926) --- .../_application_controller_form.coffee | 4 ++ .../form_hander_dependencies.coffee | 1 + script/build/test_slice_tests.sh | 6 +++ test/browser/agent_ticket_update5_test.rb | 50 +++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 test/browser/agent_ticket_update5_test.rb diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 3fadb2697..ed8b58084 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -259,6 +259,10 @@ class App.ControllerForm extends App.Controller if attribute.name of @params attribute.value = @params[attribute.name] + # set new value + if 'newValue' of attribute + attribute.value = attribute.newValue + App.Log.debug 'ControllerForm', 'formGenItem-before', attribute if App.UiElement[attribute.tag] diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/form_hander_dependencies.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/form_hander_dependencies.coffee index 6f68852a8..8c3b2c76f 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/form_hander_dependencies.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/form_hander_dependencies.coffee @@ -20,6 +20,7 @@ class TicketZoomFormHanderDependencies item['filter'] = {} item['filter'][ fieldNameToChange ] = filter item.default = params[item.name] + item.newValue = params[item.name] #if !item.default # delete item['default'] newElement = ui.formGenItem(item, classname, form) diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index ef81409d0..f49030955 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -41,6 +41,7 @@ if [ "$LEVEL" == '1' ]; then rm test/browser/agent_ticket_update2_test.rb rm test/browser/agent_ticket_update3_test.rb rm test/browser/agent_ticket_update4_test.rb + rm test/browser/agent_ticket_update5_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb @@ -106,6 +107,7 @@ elif [ "$LEVEL" == '2' ]; then # test/browser/agent_ticket_update2_test.rb # test/browser/agent_ticket_update3_test.rb # test/browser/agent_ticket_update4_test.rb + # rm test/browser/agent_ticket_update5_test.rb # test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb @@ -171,6 +173,7 @@ elif [ "$LEVEL" == '3' ]; then rm test/browser/agent_ticket_update2_test.rb rm test/browser/agent_ticket_update3_test.rb rm test/browser/agent_ticket_update4_test.rb + rm test/browser/agent_ticket_update5_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb @@ -236,6 +239,7 @@ elif [ "$LEVEL" == '4' ]; then rm test/browser/agent_ticket_update2_test.rb rm test/browser/agent_ticket_update3_test.rb rm test/browser/agent_ticket_update4_test.rb + rm test/browser/agent_ticket_update5_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb @@ -300,6 +304,7 @@ elif [ "$LEVEL" == '5' ]; then rm test/browser/agent_ticket_update2_test.rb rm test/browser/agent_ticket_update3_test.rb rm test/browser/agent_ticket_update4_test.rb + rm test/browser/agent_ticket_update5_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb # test/browser/agent_user_manage_test.rb # test/browser/agent_user_profile_test.rb @@ -367,6 +372,7 @@ elif [ "$LEVEL" == '6' ]; then rm test/browser/agent_ticket_update2_test.rb rm test/browser/agent_ticket_update3_test.rb rm test/browser/agent_ticket_update4_test.rb + rm test/browser/agent_ticket_update5_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb diff --git a/test/browser/agent_ticket_update5_test.rb b/test/browser/agent_ticket_update5_test.rb new file mode 100644 index 000000000..c21ab1327 --- /dev/null +++ b/test/browser/agent_ticket_update5_test.rb @@ -0,0 +1,50 @@ + +require 'browser_test_helper' + +class AgentTicketUpdate5Test < TestCase + def test_check_changes + @browser = browser_instance + + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + + # create ticket + + ticket1 = ticket_create( + data: { + customer: 'Nico', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', + } + ) + + select( + css: '.content.active .sidebar select[name="owner_id"]', + value: 'Agent 1 Test', + ) + + click(css: '.content.active .js-attributeBar .js-submit', wait: 2) + + select( + css: '.content.active .sidebar select[name="group_id"]', + value: '-', + ) + + select( + css: '.content.active .sidebar select[name="group_id"]', + value: 'Users', + ) + + sleep 1 + + match( + css: '.content.active .sidebar select[name="owner_id"]', + value: '-' + ) + + end +end