Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes issue #2516 - trigger email notification UI defective on remova…
…l of recipient.
- Loading branch information
1 parent
c7d1b9d
commit db531e6
Showing
7 changed files
with
264 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
<link rel="stylesheet" href="/assets/tests/qunit-1.21.0.css"> | ||
<script src="/assets/tests/qunit-1.21.0.js"></script> | ||
<script src="/assets/tests/form_ticket_perform_action.js"></script> | ||
|
||
<style type="text/css"> | ||
body { | ||
padding-top: 0px; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript"> | ||
</script> | ||
|
||
<div id="qunit" class="u-dontfold"></div> | ||
|
||
<div> | ||
<form class="form-stacked pull-left"> | ||
<div id="forms"></div> | ||
<button type="submit" class="btn btn-primary submit">Submit</button> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
Zammad::Application.routes.draw do | ||
|
||
match '/tests_core', to: 'tests#core', via: :get | ||
match '/tests_session', to: 'tests#session', via: :get | ||
match '/tests_ui', to: 'tests#ui', via: :get | ||
match '/tests_model', to: 'tests#model', via: :get | ||
match '/tests_model_binding', to: 'tests#model_binding', via: :get | ||
match '/tests_model_ui', to: 'tests#model_ui', via: :get | ||
match '/tests_form', to: 'tests#form', via: :get | ||
match '/tests_form_tree_select', to: 'tests#form_tree_select', via: :get | ||
match '/tests_form_find', to: 'tests#form_find', via: :get | ||
match '/tests_form_trim', to: 'tests#form_trim', via: :get | ||
match '/tests_form_extended', to: 'tests#form_extended', via: :get | ||
match '/tests_form_timer', to: 'tests#form_timer', via: :get | ||
match '/tests_form_validation', to: 'tests#form_validation', via: :get | ||
match '/tests_form_column_select', to: 'tests#form_column_select', via: :get | ||
match '/tests_form_searchable_select', to: 'tests#form_searchable_select', via: :get | ||
match '/tests_table', to: 'tests#table', via: :get | ||
match '/tests_table_extended', to: 'tests#table_extended', via: :get | ||
match '/tests_html_utils', to: 'tests#html_utils', via: :get | ||
match '/tests_ticket_selector', to: 'tests#ticket_selector', via: :get | ||
match '/tests_taskbar', to: 'tests#taskbar', via: :get | ||
match '/tests/wait/:sec', to: 'tests#wait', via: :get | ||
match '/tests/unprocessable_entity', to: 'tests#error_unprocessable_entity', via: :get | ||
match '/tests/not_authorized', to: 'tests#error_not_authorized', via: :get | ||
match '/tests/ar_not_found', to: 'tests#error_ar_not_found', via: :get | ||
match '/tests/standard_error', to: 'tests#error_standard_error', via: :get | ||
match '/tests/argument_error', to: 'tests#error_argument_error', via: :get | ||
match '/tests_core', to: 'tests#core', via: :get | ||
match '/tests_session', to: 'tests#session', via: :get | ||
match '/tests_ui', to: 'tests#ui', via: :get | ||
match '/tests_model', to: 'tests#model', via: :get | ||
match '/tests_model_binding', to: 'tests#model_binding', via: :get | ||
match '/tests_model_ui', to: 'tests#model_ui', via: :get | ||
match '/tests_form', to: 'tests#form', via: :get | ||
match '/tests_form_tree_select', to: 'tests#form_tree_select', via: :get | ||
match '/tests_form_find', to: 'tests#form_find', via: :get | ||
match '/tests_form_trim', to: 'tests#form_trim', via: :get | ||
match '/tests_form_extended', to: 'tests#form_extended', via: :get | ||
match '/tests_form_timer', to: 'tests#form_timer', via: :get | ||
match '/tests_form_validation', to: 'tests#form_validation', via: :get | ||
match '/tests_form_column_select', to: 'tests#form_column_select', via: :get | ||
match '/tests_form_searchable_select', to: 'tests#form_searchable_select', via: :get | ||
match '/tests_form_ticket_perform_action', to: 'tests#form_ticket_perform_action', via: :get | ||
match '/tests_table', to: 'tests#table', via: :get | ||
match '/tests_table_extended', to: 'tests#table_extended', via: :get | ||
match '/tests_html_utils', to: 'tests#html_utils', via: :get | ||
match '/tests_ticket_selector', to: 'tests#ticket_selector', via: :get | ||
match '/tests_taskbar', to: 'tests#taskbar', via: :get | ||
match '/tests/wait/:sec', to: 'tests#wait', via: :get | ||
match '/tests/unprocessable_entity', to: 'tests#error_unprocessable_entity', via: :get | ||
match '/tests/not_authorized', to: 'tests#error_not_authorized', via: :get | ||
match '/tests/ar_not_found', to: 'tests#error_ar_not_found', via: :get | ||
match '/tests/standard_error', to: 'tests#error_standard_error', via: :get | ||
match '/tests/argument_error', to: 'tests#error_argument_error', via: :get | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
// ticket_perform_action | ||
test( "ticket_perform_action check", function() { | ||
|
||
App.TicketPriority.refresh([ | ||
{ | ||
id: 2, | ||
name: '2 normal', | ||
active: false, | ||
}, | ||
{ | ||
id: 1, | ||
name: '1 low', | ||
active: true, | ||
}, | ||
]) | ||
|
||
App.TicketState.refresh([ | ||
{ | ||
id: 1, | ||
name: 'new', | ||
active: true, | ||
}, | ||
{ | ||
id: 2, | ||
name: 'open', | ||
active: true, | ||
}, | ||
{ | ||
id: 3, | ||
name: 'closed', | ||
active: false, | ||
}, | ||
]) | ||
|
||
$('#forms').append('<hr><h1>ticket_perform_action check</h1><form id="form1"></form>') | ||
var el = $('#form1') | ||
var defaults = { | ||
ticket_perform_action1: { | ||
'ticket.state_id': { | ||
value: '2' | ||
} | ||
}, | ||
ticket_perform_action2: { | ||
'ticket.state_id': { | ||
value: '1' | ||
}, | ||
'ticket.priority_id': { | ||
value: '2' | ||
}, | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: ['ticket_owner', 'ticket_customer'], | ||
subject: 'some subject' | ||
}, | ||
}, | ||
ticket_perform_action3: { | ||
'ticket.state_id': { | ||
value: '3' | ||
}, | ||
|
||
} | ||
} | ||
new App.ControllerForm({ | ||
el: el, | ||
model: { | ||
configure_attributes: [ | ||
{ | ||
name: 'ticket_perform_action1', | ||
display: 'TicketPerformAction1', | ||
tag: 'ticket_perform_action', | ||
null: true, | ||
}, | ||
{ | ||
name: 'ticket_perform_action2', | ||
display: 'TicketPerformAction2', | ||
tag: 'ticket_perform_action', | ||
null: false, | ||
notification: true, | ||
}, | ||
{ | ||
name: 'ticket_perform_action3', | ||
display: 'TicketPerformAction3', | ||
tag: 'ticket_perform_action', | ||
null: true, | ||
notification: true, | ||
}, | ||
] | ||
}, | ||
params: defaults, | ||
autofocus: true | ||
}) | ||
|
||
var params = App.ControllerForm.params(el) | ||
var test_params = { | ||
ticket_perform_action1: { | ||
'ticket.state_id': { | ||
value: '2' | ||
} | ||
}, | ||
ticket_perform_action2: { | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: ['ticket_owner', 'ticket_customer'], | ||
subject: 'some subject' | ||
}, | ||
'ticket.priority_id': { | ||
value: '2' | ||
}, | ||
'ticket.state_id': { | ||
value: '1' | ||
}, | ||
}, | ||
ticket_perform_action3: { | ||
'ticket.state_id': { | ||
value: '3' | ||
} | ||
} | ||
} | ||
deepEqual(params, test_params, 'form param check') | ||
|
||
// add email notification | ||
$('[data-attribute-name="ticket_perform_action3"] .js-add').click() | ||
$('[data-attribute-name="ticket_perform_action3"] .js-attributeSelector .form-control').last().val('notification.email').trigger('change') | ||
$('[data-attribute-name="ticket_perform_action3"] .js-setNotification [name="ticket_perform_action3::notification.email::subject"]').val('some subject').trigger('change') | ||
$('[data-attribute-name="ticket_perform_action3"] .js-setNotification [data-name="ticket_perform_action3::notification.email::body"]').html('some body').trigger('change') | ||
$('[data-attribute-name="ticket_perform_action3"] .js-setNotification .js-recipient .js-option[data-value="ticket_owner"]').click() | ||
|
||
params = App.ControllerForm.params(el) | ||
test_params = { | ||
ticket_perform_action1: { | ||
'ticket.state_id': { | ||
value: '2' | ||
} | ||
}, | ||
ticket_perform_action2: { | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: ['ticket_owner', 'ticket_customer'], | ||
subject: 'some subject' | ||
}, | ||
'ticket.priority_id': { | ||
value: '2' | ||
}, | ||
'ticket.state_id': { | ||
value: '1' | ||
}, | ||
}, | ||
ticket_perform_action3: { | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: 'ticket_owner', | ||
subject: 'some subject' | ||
}, | ||
'ticket.state_id': { | ||
value: '3' | ||
} | ||
} | ||
} | ||
deepEqual(params, test_params, 'form param check') | ||
|
||
// remove recipient | ||
$('[data-attribute-name="ticket_perform_action2"] .js-setNotification .js-recipient .js-remove.js-option[data-value="ticket_owner"]').click() | ||
|
||
params = App.ControllerForm.params(el) | ||
test_params = { | ||
ticket_perform_action1: { | ||
'ticket.state_id': { | ||
value: '2' | ||
} | ||
}, | ||
ticket_perform_action2: { | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: 'ticket_customer', | ||
subject: 'some subject' | ||
}, | ||
'ticket.priority_id': { | ||
value: '2' | ||
}, | ||
'ticket.state_id': { | ||
value: '1' | ||
}, | ||
}, | ||
ticket_perform_action3: { | ||
'notification.email': { | ||
body: 'some body', | ||
recipient: 'ticket_owner', | ||
subject: 'some subject' | ||
}, | ||
'ticket.state_id': { | ||
value: '3' | ||
} | ||
} | ||
} | ||
deepEqual(params, test_params, 'form param check') | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters