@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
import { Alert } from 'react-native' ;
5
5
6
6
import { FeedbackForm } from '../../src/js/feedback/FeedbackForm' ;
7
- import type { FeedbackFormProps } from '../../src/js/feedback/FeedbackForm.types' ;
7
+ import type { FeedbackFormProps , FeedbackFormStyles } from '../../src/js/feedback/FeedbackForm.types' ;
8
8
9
9
const mockOnFormClose = jest . fn ( ) ;
10
10
const mockGetUser = jest . fn ( ( ) => ( {
@@ -25,26 +25,80 @@ jest.mock('@sentry/core', () => ({
25
25
const defaultProps : FeedbackFormProps = {
26
26
onFormClose : mockOnFormClose ,
27
27
formTitle : 'Feedback Form' ,
28
- nameLabel : 'Name' ,
28
+ nameLabel : 'Name Label ' ,
29
29
namePlaceholder : 'Name Placeholder' ,
30
- emailLabel : 'Email' ,
30
+ emailLabel : 'Email Label ' ,
31
31
emailPlaceholder : 'Email Placeholder' ,
32
- messageLabel : 'Description ' ,
33
- messagePlaceholder : 'Description Placeholder' ,
34
- submitButtonLabel : 'Submit' ,
35
- cancelButtonLabel : 'Cancel' ,
36
- isRequiredLabel : '(required)' ,
32
+ messageLabel : 'Message Label ' ,
33
+ messagePlaceholder : 'Message Placeholder' ,
34
+ submitButtonLabel : 'Submit Button Label ' ,
35
+ cancelButtonLabel : 'Cancel Button Label ' ,
36
+ isRequiredLabel : '(is required label )' ,
37
37
errorTitle : 'Error' ,
38
38
formError : 'Please fill out all required fields.' ,
39
39
emailError : 'The email address is not valid.' ,
40
40
successMessageText : 'Feedback success' ,
41
41
} ;
42
42
43
+ const customStyles : FeedbackFormStyles = {
44
+ container : {
45
+ backgroundColor : '#ffffff' ,
46
+ } ,
47
+ title : {
48
+ fontSize : 20 ,
49
+ color : '#ff0000' ,
50
+ } ,
51
+ label : {
52
+ fontSize : 15 ,
53
+ color : '#00ff00' ,
54
+ } ,
55
+ input : {
56
+ height : 50 ,
57
+ borderColor : '#0000ff' ,
58
+ fontSize : 13 ,
59
+ color : '#000000' ,
60
+ } ,
61
+ textArea : {
62
+ height : 50 ,
63
+ color : '#00ff00' ,
64
+ } ,
65
+ submitButton : {
66
+ backgroundColor : '#ffff00' ,
67
+ } ,
68
+ submitText : {
69
+ color : '#ff0000' ,
70
+ fontSize : 12 ,
71
+ } ,
72
+ cancelButton : {
73
+ paddingVertical : 10 ,
74
+ } ,
75
+ cancelText : {
76
+ color : '#ff0000' ,
77
+ fontSize : 10 ,
78
+ } ,
79
+ } ;
80
+
43
81
describe ( 'FeedbackForm' , ( ) => {
44
82
afterEach ( ( ) => {
45
83
jest . clearAllMocks ( ) ;
46
84
} ) ;
47
85
86
+ it ( 'matches the snapshot with default configuration' , ( ) => {
87
+ const { toJSON } = render ( < FeedbackForm /> ) ;
88
+ expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
89
+ } ) ;
90
+
91
+ it ( 'matches the snapshot with custom texts' , ( ) => {
92
+ const { toJSON } = render ( < FeedbackForm { ...defaultProps } /> ) ;
93
+ expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
94
+ } ) ;
95
+
96
+ it ( 'matches the snapshot with custom styles' , ( ) => {
97
+ const customStyleProps = { styles : customStyles } ;
98
+ const { toJSON } = render ( < FeedbackForm { ...customStyleProps } /> ) ;
99
+ expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
100
+ } ) ;
101
+
48
102
it ( 'renders correctly' , ( ) => {
49
103
const { getByPlaceholderText, getByText, getByTestId } = render ( < FeedbackForm { ...defaultProps } /> ) ;
50
104
0 commit comments