@@ -30,23 +30,18 @@ describe("FeedbackModal", () => {
3030
3131 it ( "renders when open is true" , ( ) => {
3232 render ( < FeedbackModal { ...defaultProps } /> ) ;
33- expect ( screen . getByText ( "Share Your Feedback" ) ) . toBeInTheDocument ( ) ;
34- expect (
35- screen . getByText ( "Help us improve dopeshot for you" )
36- ) . toBeInTheDocument ( ) ;
33+ expect ( screen . getByText ( "Share your feedback" ) ) . toBeInTheDocument ( ) ;
3734 } ) ;
3835
3936 it ( "does not render when open is false" , ( ) => {
4037 render ( < FeedbackModal { ...defaultProps } open = { false } /> ) ;
41- expect ( screen . queryByText ( "Share Your Feedback " ) ) . not . toBeInTheDocument ( ) ;
38+ expect ( screen . queryByText ( "Share your feedback " ) ) . not . toBeInTheDocument ( ) ;
4239 } ) ;
4340
4441 it ( "displays the feedback textarea with correct label" , ( ) => {
4542 render ( < FeedbackModal { ...defaultProps } /> ) ;
4643 expect (
47- screen . getByLabelText (
48- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
49- )
44+ screen . getByLabelText ( / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i)
5045 ) . toBeInTheDocument ( ) ;
5146 } ) ;
5247
@@ -55,55 +50,30 @@ describe("FeedbackModal", () => {
5550 expect ( screen . getByLabelText ( / E m a i l / i) ) . toBeInTheDocument ( ) ;
5651 } ) ;
5752
58- it ( "shows screenshot toggle when screenshotDataUrl is provided" , ( ) => {
53+ it ( "renders with screenshot when screenshotDataUrl is provided" , ( ) => {
5954 const screenshotDataUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" ;
6055 render (
6156 < FeedbackModal { ...defaultProps } screenshotDataUrl = { screenshotDataUrl } />
6257 ) ;
63- expect ( screen . getByText ( "Include screenshot" ) ) . toBeInTheDocument ( ) ;
64- expect ( screen . getByText ( / A t t a c h a s c r e e n s h o t o f y o u r c u r r e n t c a n v a s / i) ) . toBeInTheDocument ( ) ;
65- const toggle = screen . getByRole ( "switch" , { name : / I n c l u d e s c r e e n s h o t / i } ) ;
66- expect ( toggle ) . toBeInTheDocument ( ) ;
67- expect ( toggle ) . toBeChecked ( ) ;
68- } ) ;
69-
70- it ( "allows toggling screenshot inclusion" , async ( ) => {
71- const screenshotDataUrl = "data:image/png;base64,test" ;
72- render (
73- < FeedbackModal { ...defaultProps } screenshotDataUrl = { screenshotDataUrl } />
74- ) ;
75-
76- const toggle = screen . getByRole ( "switch" , { name : / I n c l u d e s c r e e n s h o t / i } ) ;
77- expect ( toggle ) . toBeChecked ( ) ;
78-
79- // Toggle off
80- fireEvent . click ( toggle ) ;
81- await waitFor ( ( ) => {
82- expect ( toggle ) . not . toBeChecked ( ) ;
83- } ) ;
84-
85- // Toggle back on
86- fireEvent . click ( toggle ) ;
87- await waitFor ( ( ) => {
88- expect ( toggle ) . toBeChecked ( ) ;
89- } ) ;
58+ // Modal should render normally with screenshot prop
59+ expect ( screen . getByText ( "Share your feedback" ) ) . toBeInTheDocument ( ) ;
9060 } ) ;
9161
9262 it ( "disables submit button when feedback is empty" , ( ) => {
9363 render ( < FeedbackModal { ...defaultProps } /> ) ;
94- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
64+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
9565 expect ( submitButton ) . toBeDisabled ( ) ;
9666 } ) ;
9767
9868 it ( "enables submit button when feedback is provided" , async ( ) => {
9969 render ( < FeedbackModal { ...defaultProps } /> ) ;
10070
10171 const textarea = screen . getByLabelText (
102- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
72+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
10373 ) ;
10474 fireEvent . change ( textarea , { target : { value : "This is my feedback" } } ) ;
10575
106- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
76+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
10777 expect ( submitButton ) . not . toBeDisabled ( ) ;
10878 } ) ;
10979
@@ -118,16 +88,16 @@ describe("FeedbackModal", () => {
11888 render ( < FeedbackModal { ...defaultProps } onOpenChange = { onOpenChange } /> ) ;
11989
12090 const textarea = screen . getByLabelText (
121- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
91+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
12292 ) ;
12393 fireEvent . change ( textarea , { target : { value : "Great app!" } } ) ;
12494
125- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
95+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
12696 fireEvent . click ( submitButton ) ;
12797
12898 // Should show success message
12999 await waitFor ( ( ) => {
130- expect ( screen . getByText ( "Thank you for your feedback !" ) ) . toBeInTheDocument ( ) ;
100+ expect ( screen . getByText ( "Thank you!" ) ) . toBeInTheDocument ( ) ;
131101 } ) ;
132102
133103 // Should close modal after success
@@ -145,11 +115,11 @@ describe("FeedbackModal", () => {
145115 render ( < FeedbackModal { ...defaultProps } /> ) ;
146116
147117 const textarea = screen . getByLabelText (
148- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
118+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
149119 ) ;
150120 fireEvent . change ( textarea , { target : { value : "Great app!" } } ) ;
151121
152- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
122+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
153123 fireEvent . click ( submitButton ) ;
154124
155125 // Should show error message
@@ -167,14 +137,14 @@ describe("FeedbackModal", () => {
167137 render ( < FeedbackModal { ...defaultProps } /> ) ;
168138
169139 const textarea = screen . getByLabelText (
170- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
140+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
171141 ) ;
172142 fireEvent . change ( textarea , { target : { value : "Great app!" } } ) ;
173143
174144 const emailInput = screen . getByLabelText ( / E m a i l / i) ;
175145 fireEvent . change ( emailInput , { target : { value : "test@example.com" } } ) ;
176146
177- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
147+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
178148 fireEvent . click ( submitButton ) ;
179149
180150 await waitFor ( ( ) => {
@@ -201,11 +171,11 @@ describe("FeedbackModal", () => {
201171 ) ;
202172
203173 const textarea = screen . getByLabelText (
204- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
174+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
205175 ) ;
206176 fireEvent . change ( textarea , { target : { value : "Great app!" } } ) ;
207177
208- const submitButton = screen . getByRole ( "button" , { name : / S e n d F e e d b a c k / i } ) ;
178+ const submitButton = screen . getByRole ( "button" , { name : / S e n d / i } ) ;
209179 fireEvent . click ( submitButton ) ;
210180
211181 await waitFor ( ( ) => {
@@ -219,13 +189,13 @@ describe("FeedbackModal", () => {
219189 } ) ;
220190 } ) ;
221191
222- it ( "allows canceling the feedback " , ( ) => {
192+ it ( "allows closing the modal via close button " , ( ) => {
223193 const onOpenChange = vi . fn ( ) ;
224194
225195 render ( < FeedbackModal { ...defaultProps } onOpenChange = { onOpenChange } /> ) ;
226196
227- const cancelButton = screen . getByRole ( "button" , { name : / C a n c e l / i } ) ;
228- fireEvent . click ( cancelButton ) ;
197+ const closeButton = screen . getByRole ( "button" , { name : / C l o s e / i } ) ;
198+ fireEvent . click ( closeButton ) ;
229199
230200 expect ( onOpenChange ) . toHaveBeenCalledWith ( false ) ;
231201 } ) ;
@@ -237,7 +207,7 @@ describe("FeedbackModal", () => {
237207 rerender ( < FeedbackModal { ...defaultProps } open = { true } /> ) ;
238208
239209 const textarea = screen . getByLabelText (
240- / W h a t a r e y o u t r y i n g t o d o , a n d w h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
210+ / W h a t w o u l d m a k e d o p e s h o t b e t t e r f o r y o u / i
241211 ) ;
242212
243213 // Form should be empty
0 commit comments