@@ -69,9 +69,15 @@ const DiscountCode: React.FC<DiscountCodeProps> = ({ cart }) => {
69
69
>
70
70
< Text className = "flex gap-x-1 items-baseline" >
71
71
< span > Code: </ span >
72
- < span className = "truncate" data-testid = "gift-card-code" > { gc . code } </ span >
72
+ < span className = "truncate" data-testid = "gift-card-code" >
73
+ { gc . code }
74
+ </ span >
73
75
</ Text >
74
- < Text className = "font-semibold" data-testid = "gift-card-amount" >
76
+ < Text
77
+ className = "font-semibold"
78
+ data-testid = "gift-card-amount"
79
+ data-value = { gc . balance }
80
+ >
75
81
{ formatAmount ( {
76
82
region : region ,
77
83
amount : gc . balance ,
@@ -95,15 +101,27 @@ const DiscountCode: React.FC<DiscountCodeProps> = ({ cart }) => {
95
101
< div className = "w-full flex items-center" >
96
102
< div className = "flex flex-col w-full" >
97
103
< Heading className = "txt-medium" > Discount applied:</ Heading >
98
- < div className = "flex items-center justify-between w-full max-w-full" >
104
+ < div
105
+ className = "flex items-center justify-between w-full max-w-full"
106
+ data-testid = "discount-row"
107
+ >
99
108
< Text className = "flex gap-x-1 items-baseline txt-small-plus w-4/5 pr-1" >
100
109
< span > Code:</ span >
101
- < span className = "truncate" > { discounts [ 0 ] . code } </ span >
102
- < span className = "min-w-fit" > ({ appliedDiscount } )</ span >
110
+ < span className = "truncate" data-testid = "discount-code" >
111
+ { discounts [ 0 ] . code }
112
+ </ span >
113
+ < span
114
+ className = "min-w-fit"
115
+ data-testid = "discount-amount"
116
+ data-value = { discounts [ 0 ] . rule . value }
117
+ >
118
+ ({ appliedDiscount } )
119
+ </ span >
103
120
</ Text >
104
121
< button
105
122
className = "flex items-center"
106
123
onClick = { removeDiscountCode }
124
+ data-testid = "remove-discount-button"
107
125
>
108
126
< Trash size = { 14 } />
109
127
< span className = "sr-only" >
@@ -138,9 +156,17 @@ const DiscountCode: React.FC<DiscountCodeProps> = ({ cart }) => {
138
156
autoFocus = { false }
139
157
data-testid = "discount-input"
140
158
/>
141
- < SubmitButton variant = "secondary" data-testid = "discount-apply-button" > Apply</ SubmitButton >
159
+ < SubmitButton
160
+ variant = "secondary"
161
+ data-testid = "discount-apply-button"
162
+ >
163
+ Apply
164
+ </ SubmitButton >
142
165
</ div >
143
- < ErrorMessage error = { message } data-testid = "discount-error-message" />
166
+ < ErrorMessage
167
+ error = { message }
168
+ data-testid = "discount-error-message"
169
+ />
144
170
</ >
145
171
) }
146
172
</ form >
0 commit comments