File tree Expand file tree Collapse file tree 4 files changed +80
-0
lines changed
components/forms/admin/settings/system/mail-settings
templates/components/forms/admin/settings/system
tests/integration/components/forms/admin/settings/system/mail-settings Expand file tree Collapse file tree 4 files changed +80
-0
lines changed Original file line number Diff line number Diff line change
1
+ import Component from '@ember/component' ;
2
+ import FormMixin from 'open-event-frontend/mixins/form' ;
3
+
4
+ export default Component . extend ( FormMixin , {
5
+ getValidationRules ( ) {
6
+ return {
7
+ inline : true ,
8
+ delay : false ,
9
+ on : 'blur' ,
10
+ fields : {
11
+ testEmail : {
12
+ identifier : 'test_email' ,
13
+ rules : [
14
+ {
15
+ type : 'empty' ,
16
+ prompt : this . l10n . t ( 'Please enter the recepient E-mail' )
17
+ } ,
18
+ {
19
+ type : 'email' ,
20
+ prompt : this . l10n . t ( 'Please enter a valid email address' )
21
+ }
22
+ ]
23
+ }
24
+ }
25
+ } ;
26
+ } ,
27
+ actions : {
28
+ sendTestMail ( ) {
29
+ this . onValid ( ( ) => {
30
+ let payload = {
31
+ recipient : this . recipientEmail
32
+ } ;
33
+ let config = {
34
+ skipDataTransform : true
35
+ } ;
36
+ this . loader . post ( '/test-mail' , JSON . stringify ( payload ) , config )
37
+ . then ( response => {
38
+ this . notify . success ( response . message ) ;
39
+ } )
40
+ . catch ( e => {
41
+ console . warn ( e ) ;
42
+ this . notify . error ( this . l10n . t ( 'An unexpected error has occurred' ) ) ;
43
+ } ) ;
44
+ } ) ;
45
+ }
46
+ }
47
+ } ) ;
Original file line number Diff line number Diff line change 95
95
{{ input type =' text' name =' sendgrid_token' value =settings.sendgridKey }}
96
96
</div >
97
97
{{ /if }}
98
+ {{ forms/admin/settings/system/mail-settings/test-email-form }}
Original file line number Diff line number Diff line change
1
+ <div class =" ui form" >
2
+ {{ #ui-accordion class =' field' }}
3
+ <div class =" title" >
4
+ <i class =" icon dropdown" ></i >
5
+ {{ t ' Send Test Email' }}
6
+ </div >
7
+ <div class =" content four wide field" >
8
+ <div class =" ui action input" >
9
+ {{ input type =" text" placeholder = (t ' Recipient E-mail' ) name =' test_email' value =recipientEmail }}
10
+ <div class =" ui secondary button" role =" button" {{ action ' sendTestMail' }} >
11
+ {{ t ' Test' }}
12
+ </div >
13
+ </div >
14
+ </div >
15
+ {{ /ui-accordion }}
16
+ </div >
Original file line number Diff line number Diff line change
1
+ import { module , test } from 'qunit' ;
2
+ import { setupRenderingTest } from 'ember-qunit' ;
3
+ import { render } from '@ember/test-helpers' ;
4
+ import hbs from 'htmlbars-inline-precompile' ;
5
+
6
+ module ( 'Integration | Component | forms/admin/settings/system/mail-settings/test-email-form' , function ( hooks ) {
7
+ setupRenderingTest ( hooks ) ;
8
+
9
+ test ( 'it renders' , async function ( assert ) {
10
+
11
+ await render ( hbs `{{forms/admin/settings/system/mail-settings/test-email-form}}` ) ;
12
+
13
+ assert . ok ( this . element . innerHTML . trim ( ) . includes ( 'Send Test Email' ) ) ;
14
+
15
+ } ) ;
16
+ } ) ;
You can’t perform that action at this time.
0 commit comments