Skip to content

Commit 3ba39f5

Browse files
authored
test(chat): update tests for chat (#556)
1 parent 6341eea commit 3ba39f5

11 files changed

+2007
-216
lines changed

src/chat/__tests__/__snapshots__/content.test.tsx.snap

+1-43
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`Test Chat Content Match snapshot: normal 1`] = `
44
<DocumentFragment>
55
<div
6-
class="dtc__aigc__content__container dtc__aigc__content__container--valid"
6+
class="dtc__aigc__content__container"
77
>
88
<div
99
class="dtc__aigc__content__inner__holder"
@@ -48,48 +48,6 @@ exports[`Test Chat Content Match snapshot: placeholder 1`] = `
4848
<div>
4949
placeholder
5050
</div>
51-
<span
52-
class="dtc__icon"
53-
style="font-size: 200px; position: absolute; right: 0px; bottom: -100px;"
54-
>
55-
<svg
56-
fill="none"
57-
height="1em"
58-
viewBox="0 0 268 265"
59-
width="1em"
60-
xmlns="http://www.w3.org/2000/svg"
61-
>
62-
<path
63-
clip-rule="evenodd"
64-
d="M210.656 14.094c0-7.266-5.89-13.156-13.156-13.156-7.266 0-13.156 5.89-13.156 13.156V27.25h-72.36c-14.532 0-26.312 11.78-26.312 26.313V237.75c0 14.532 11.78 26.313 26.312 26.313h171.032c14.532 0 26.312-11.781 26.312-26.313V53.562c0-14.531-11.78-26.312-26.312-26.312h-72.36V14.094zm72.36 39.468H111.984V237.75h171.032V53.562zm-111.828 85.516c0 10.899-8.836 19.735-19.735 19.735s-19.734-8.836-19.734-19.735 8.835-19.734 19.734-19.734c10.899 0 19.735 8.835 19.735 19.734zm-105.25-32.89c0-7.267-5.89-13.157-13.157-13.157-7.266 0-13.156 5.89-13.156 13.157v78.937c0 7.266 5.89 13.156 13.156 13.156 7.266 0 13.157-5.89 13.157-13.156v-78.937zm-52.626 13.156c7.266 0 13.157 5.89 13.157 13.156v26.313c0 7.266-5.89 13.156-13.157 13.156-7.265 0-13.156-5.89-13.156-13.156V132.5c0-7.266 5.89-13.156 13.156-13.156zM394.844 132.5c0-7.266-5.89-13.156-13.156-13.156-7.266 0-13.157 5.89-13.157 13.156v26.313c0 7.266 5.891 13.156 13.157 13.156s13.156-5.89 13.156-13.156V132.5zm-52.625-39.469c7.266 0 13.156 5.89 13.156 13.157v78.937c0 7.266-5.89 13.156-13.156 13.156-7.266 0-13.156-5.89-13.156-13.156v-78.937c0-7.267 5.89-13.157 13.156-13.157zm-98.672 65.782c10.899 0 19.734-8.836 19.734-19.735s-8.835-19.734-19.734-19.734c-10.899 0-19.734 8.835-19.734 19.734 0 10.899 8.835 19.735 19.734 19.735z"
65-
fill="url(#paint0_linear_1290_3143)"
66-
fill-opacity="0.03"
67-
fill-rule="evenodd"
68-
/>
69-
<defs>
70-
<lineargradient
71-
gradientUnits="userSpaceOnUse"
72-
id="paint0_linear_1290_3143"
73-
x1="0.156"
74-
x2="415.745"
75-
y1="0.938"
76-
y2="225.356"
77-
>
78-
<stop
79-
stop-color="#00BAC6"
80-
/>
81-
<stop
82-
offset="0.5"
83-
stop-color="#0067FF"
84-
/>
85-
<stop
86-
offset="1"
87-
stop-color="#450FDE"
88-
/>
89-
</lineargradient>
90-
</defs>
91-
</svg>
92-
</span>
9351
</div>
9452
</DocumentFragment>
9553
`;

src/chat/__tests__/__snapshots__/icon.test.tsx.snap

+80-87
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Test Chat Icon Match Snapshots: AssistantAvatarIcon 1`] = `
4-
<DocumentFragment>
5-
<span
6-
class="dtc__icon"
7-
>
8-
<svg
9-
fill="none"
10-
height="1em"
11-
viewBox="0 0 16 16"
12-
width="1em"
13-
xmlns="http://www.w3.org/2000/svg"
14-
>
15-
<path
16-
clip-rule="evenodd"
17-
d="M13.2249 2.24668C12.5545 1.83267 11.6454 1.84694 10.6692 2.13558C10.482 1.96208 10.2315 1.85602 9.95613 1.85602C9.37667 1.85602 8.90692 2.32577 8.90692 2.90523C8.90692 3.48469 9.37667 3.95444 9.95613 3.95444C10.475 3.95444 10.9058 3.57787 10.9903 3.08314C11.8066 2.84774 12.3783 2.89916 12.6994 3.09749C13.0386 3.307 13.2721 3.81542 13.0387 4.82216C12.8098 5.80962 12.1687 7.04337 11.19 8.30528C10.2872 9.46932 9.1701 10.563 8.00924 11.4242C7.85403 11.309 7.69829 11.1888 7.54246 11.0635C6.45332 10.1883 5.44006 9.13558 4.63395 8.04889C5.08983 7.43435 5.61835 6.82198 6.2003 6.24003C6.39556 6.04477 6.39556 5.72819 6.2003 5.53293C6.00504 5.33766 5.68846 5.33766 5.49319 5.53293C4.96591 6.06021 4.47627 6.61494 4.03849 7.17937C3.33769 6.06253 2.95286 5.05034 2.89459 4.28651C2.86262 3.86738 2.9324 3.5722 3.04732 3.37607C3.15616 3.19032 3.3283 3.05298 3.5965 2.98067C4.17696 2.82416 5.14096 2.99647 6.36827 3.63487C7.57146 4.26073 8.8626 5.24974 10.0126 6.43768C10.2047 6.63609 10.5212 6.64122 10.7196 6.44915C10.918 6.25708 10.9232 5.94054 10.7311 5.74214C9.52047 4.49158 8.14491 3.43182 6.82973 2.74771C5.53869 2.07616 4.28848 1.75838 3.33617 2.01515C2.83799 2.14947 2.43782 2.43823 2.18452 2.87052C1.9373 3.29243 1.85513 3.80725 1.89749 4.36257C1.97977 5.44118 2.53563 6.74106 3.41055 8.04888C3.09627 8.51867 2.82218 8.98889 2.59626 9.44961C1.96985 10.727 1.6998 11.9623 2.02581 12.8839C2.197 13.3679 2.52392 13.7358 2.97831 13.9516C3.42032 14.1615 3.94762 14.2116 4.513 14.1415C5.55132 14.0129 6.77601 13.4726 8.00924 12.6476C8.97593 13.2942 9.9375 13.7661 10.8079 14.0017C11.9796 14.3189 13.0998 14.2252 13.7179 13.4017C14.2314 12.7178 14.2295 11.7357 13.9168 10.6895C14.0549 10.5119 14.1371 10.2887 14.1371 10.0463C14.1371 9.46682 13.6673 8.99707 13.0878 8.99707C12.5084 8.99707 12.0386 9.46682 12.0386 10.0463C12.0386 10.5935 12.4576 11.0429 12.9922 11.0912C13.2261 11.9404 13.141 12.5046 12.9182 12.8014C12.6798 13.119 12.1181 13.3204 11.0692 13.0365C10.4136 12.859 9.66391 12.5122 8.87876 12.0196C10.0149 11.1384 11.0939 10.0608 11.9802 8.91814C13.009 7.59159 13.7396 6.22667 14.0129 5.04802C14.2817 3.88865 14.1168 2.79755 13.2249 2.24668ZM3.49412 9.88989C3.64988 9.57224 3.83234 9.24694 4.03848 8.91841C4.86023 9.97789 5.85456 10.99 6.91605 11.843C6.99046 11.9028 7.06503 11.9617 7.13973 12.0196C6.09871 12.6728 5.14128 13.0561 4.39004 13.1491C3.94819 13.2039 3.62654 13.1524 3.4073 13.0483C3.20043 12.95 3.05381 12.7914 2.96856 12.5504C2.7817 12.0222 2.89898 11.1035 3.49412 9.88989ZM7.18854 7.99999C7.18854 7.5518 7.55186 7.18848 8.00005 7.18848C8.44824 7.18848 8.81157 7.5518 8.81157 7.99999C8.81157 8.44818 8.44824 8.81151 8.00005 8.81151C7.55186 8.81151 7.18854 8.44818 7.18854 7.99999ZM8.00005 6.18848C6.99958 6.18848 6.18854 6.99952 6.18854 7.99999C6.18854 9.00046 6.99958 9.81151 8.00005 9.81151C9.00052 9.81151 9.81157 9.00046 9.81157 7.99999C9.81157 6.99952 9.00052 6.18848 8.00005 6.18848Z"
18-
fill="url(#paint0_linear_5380_77452)"
19-
fill-rule="evenodd"
20-
/>
21-
<defs>
22-
<lineargradient
23-
gradientUnits="userSpaceOnUse"
24-
id="paint0_linear_5380_77452"
25-
x1="1.88672"
26-
x2="16.6535"
27-
y1="1.85602"
28-
y2="7.14405"
29-
>
30-
<stop
31-
stop-color="#00BAC6"
32-
/>
33-
<stop
34-
offset="0.5"
35-
stop-color="#0067FF"
36-
/>
37-
<stop
38-
offset="1"
39-
stop-color="#450FDE"
40-
/>
41-
</lineargradient>
42-
</defs>
43-
</svg>
44-
</span>
45-
</DocumentFragment>
46-
`;
47-
483
exports[`Test Chat Icon Match Snapshots: CopyIcon 1`] = `
494
<DocumentFragment>
505
<span
@@ -199,33 +154,32 @@ exports[`Test Chat Icon Match Snapshots: ReloadIcon 1`] = `
199154
</DocumentFragment>
200155
`;
201156

202-
exports[`Test Chat Icon Match Snapshots: RobotIcon 1`] = `
157+
exports[`Test Chat Icon Match Snapshots: SendIcon 1`] = `
203158
<DocumentFragment>
204159
<span
205160
class="dtc__icon"
206161
>
207162
<svg
208163
fill="none"
209164
height="1em"
210-
viewBox="0 0 268 265"
165+
viewBox="0 0 24 24"
211166
width="1em"
212167
xmlns="http://www.w3.org/2000/svg"
213168
>
214169
<path
215170
clip-rule="evenodd"
216-
d="M210.656 14.094c0-7.266-5.89-13.156-13.156-13.156-7.266 0-13.156 5.89-13.156 13.156V27.25h-72.36c-14.532 0-26.312 11.78-26.312 26.313V237.75c0 14.532 11.78 26.313 26.312 26.313h171.032c14.532 0 26.312-11.781 26.312-26.313V53.562c0-14.531-11.78-26.312-26.312-26.312h-72.36V14.094zm72.36 39.468H111.984V237.75h171.032V53.562zm-111.828 85.516c0 10.899-8.836 19.735-19.735 19.735s-19.734-8.836-19.734-19.735 8.835-19.734 19.734-19.734c10.899 0 19.735 8.835 19.735 19.734zm-105.25-32.89c0-7.267-5.89-13.157-13.157-13.157-7.266 0-13.156 5.89-13.156 13.157v78.937c0 7.266 5.89 13.156 13.156 13.156 7.266 0 13.157-5.89 13.157-13.156v-78.937zm-52.626 13.156c7.266 0 13.157 5.89 13.157 13.156v26.313c0 7.266-5.89 13.156-13.157 13.156-7.265 0-13.156-5.89-13.156-13.156V132.5c0-7.266 5.89-13.156 13.156-13.156zM394.844 132.5c0-7.266-5.89-13.156-13.156-13.156-7.266 0-13.157 5.89-13.157 13.156v26.313c0 7.266 5.891 13.156 13.157 13.156s13.156-5.89 13.156-13.156V132.5zm-52.625-39.469c7.266 0 13.156 5.89 13.156 13.157v78.937c0 7.266-5.89 13.156-13.156 13.156-7.266 0-13.156-5.89-13.156-13.156v-78.937c0-7.267 5.89-13.157 13.156-13.157zm-98.672 65.782c10.899 0 19.734-8.836 19.734-19.735s-8.835-19.734-19.734-19.734c-10.899 0-19.734 8.835-19.734 19.734 0 10.899 8.835 19.735 19.734 19.735z"
217-
fill="url(#paint0_linear_1290_3143)"
218-
fill-opacity="0.03"
171+
d="M17.999 3.858 3.35 9.204a1.66 1.66 0 0 0-1.095 1.458 1.66 1.66 0 0 0 .862 1.602l4.454 2.44c.27.143.593.098.808-.118l.737-.72 4.508-4.428a.677.677 0 0 1 .952.018c.26.261.26.693-.009.954l-4.562 4.473-.61.603a.68.68 0 0 0-.118.828l2.64 4.626c.315.513.845.81 1.429.81.063 0 .117 0 .18-.009a1.68 1.68 0 0 0 1.41-1.107L20.153 6a1.69 1.69 0 0 0-.404-1.764 1.64 1.64 0 0 0-1.751-.378"
172+
fill="currentColor"
219173
fill-rule="evenodd"
220174
/>
221175
<defs>
222176
<lineargradient
223177
gradientUnits="userSpaceOnUse"
224-
id="paint0_linear_1290_3143"
225-
x1="0.156"
226-
x2="415.745"
227-
y1="0.938"
228-
y2="225.356"
178+
id="paint0_linear_3878_6538"
179+
x1="2.25"
180+
x2="23.921"
181+
y1="3.75"
182+
y2="11.552"
229183
>
230184
<stop
231185
stop-color="#00BAC6"
@@ -240,31 +194,28 @@ exports[`Test Chat Icon Match Snapshots: RobotIcon 1`] = `
240194
/>
241195
</lineargradient>
242196
</defs>
243-
</svg>
244-
</span>
245-
</DocumentFragment>
246-
`;
247-
248-
exports[`Test Chat Icon Match Snapshots: SendIcon 1`] = `
249-
<DocumentFragment>
250-
<span
251-
class="dtc__icon"
252-
>
253-
<svg
254-
fill="none"
255-
height="1em"
256-
viewBox="0 0 16 16"
257-
width="1em"
258-
xmlns="http://www.w3.org/2000/svg"
259-
>
260-
<path
261-
d="M13.07 1.662a.547.547 0 11.86.676l-6.884 8.765v3.147a.547.547 0 01-.507.545l-.04.002a.547.547 0 01-.546-.547v-3.336c0-.123.041-.241.117-.338l7-8.914z"
262-
fill="currentColor"
263-
/>
264-
<path
265-
d="M13.488 1.271a.547.547 0 01.804.548L12.81 13.57a.547.547 0 01-.799.415l-3.81-2.027a.547.547 0 11.513-.965l3.11 1.654 1.25-9.902-9.92 5.425 2.169 1.149c.255.135.36.442.245.702l-.018.037a.547.547 0 01-.739.227L1.744 8.661a.547.547 0 01-.006-.963l11.75-6.427z"
266-
fill="currentColor"
267-
/>
197+
<defs>
198+
<lineargradient
199+
gradientUnits="userSpaceOnUse"
200+
id="paint0_linear_3878_6538_hover"
201+
x1="2.25"
202+
x2="23.921"
203+
y1="3.75"
204+
y2="11.552"
205+
>
206+
<stop
207+
stop-color="#08C4FF"
208+
/>
209+
<stop
210+
offset="0.5"
211+
stop-color="#4892FF"
212+
/>
213+
<stop
214+
offset="1"
215+
stop-color="#8A61FF"
216+
/>
217+
</lineargradient>
218+
</defs>
268219
</svg>
269220
</span>
270221
</DocumentFragment>
@@ -278,18 +229,60 @@ exports[`Test Chat Icon Match Snapshots: SendIcon with gradient 1`] = `
278229
<svg
279230
fill="none"
280231
height="1em"
281-
viewBox="0 0 16 16"
232+
viewBox="0 0 24 24"
282233
width="1em"
283234
xmlns="http://www.w3.org/2000/svg"
284235
>
285236
<path
286-
d="M13.07 1.662a.547.547 0 11.86.676l-6.884 8.765v3.147a.547.547 0 01-.507.545l-.04.002a.547.547 0 01-.546-.547v-3.336c0-.123.041-.241.117-.338l7-8.914z"
287-
fill="url(#secondary_linear_gradient)"
288-
/>
289-
<path
290-
d="M13.488 1.271a.547.547 0 01.804.548L12.81 13.57a.547.547 0 01-.799.415l-3.81-2.027a.547.547 0 11.513-.965l3.11 1.654 1.25-9.902-9.92 5.425 2.169 1.149c.255.135.36.442.245.702l-.018.037a.547.547 0 01-.739.227L1.744 8.661a.547.547 0 01-.006-.963l11.75-6.427z"
291-
fill="url(#secondary_linear_gradient)"
237+
clip-rule="evenodd"
238+
d="M17.999 3.858 3.35 9.204a1.66 1.66 0 0 0-1.095 1.458 1.66 1.66 0 0 0 .862 1.602l4.454 2.44c.27.143.593.098.808-.118l.737-.72 4.508-4.428a.677.677 0 0 1 .952.018c.26.261.26.693-.009.954l-4.562 4.473-.61.603a.68.68 0 0 0-.118.828l2.64 4.626c.315.513.845.81 1.429.81.063 0 .117 0 .18-.009a1.68 1.68 0 0 0 1.41-1.107L20.153 6a1.69 1.69 0 0 0-.404-1.764 1.64 1.64 0 0 0-1.751-.378"
239+
fill="url(#paint0_linear_3878_6538)"
240+
fill-rule="evenodd"
292241
/>
242+
<defs>
243+
<lineargradient
244+
gradientUnits="userSpaceOnUse"
245+
id="paint0_linear_3878_6538"
246+
x1="2.25"
247+
x2="23.921"
248+
y1="3.75"
249+
y2="11.552"
250+
>
251+
<stop
252+
stop-color="#00BAC6"
253+
/>
254+
<stop
255+
offset="0.5"
256+
stop-color="#0067FF"
257+
/>
258+
<stop
259+
offset="1"
260+
stop-color="#450FDE"
261+
/>
262+
</lineargradient>
263+
</defs>
264+
<defs>
265+
<lineargradient
266+
gradientUnits="userSpaceOnUse"
267+
id="paint0_linear_3878_6538_hover"
268+
x1="2.25"
269+
x2="23.921"
270+
y1="3.75"
271+
y2="11.552"
272+
>
273+
<stop
274+
stop-color="#08C4FF"
275+
/>
276+
<stop
277+
offset="0.5"
278+
stop-color="#4892FF"
279+
/>
280+
<stop
281+
offset="1"
282+
stop-color="#8A61FF"
283+
/>
284+
</lineargradient>
285+
</defs>
293286
</svg>
294287
</span>
295288
</DocumentFragment>

src/chat/__tests__/__snapshots__/input.test.tsx.snap

+69-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,74 @@
22

33
exports[`Test Chat Input Match snapshot 1`] = `
44
<DocumentFragment>
5-
<textarea
6-
class="ant-input aigc-textarea"
7-
/>
5+
<div
6+
class="dtc__chat__textarea__container"
7+
>
8+
<textarea
9+
class="ant-input dtc__chat__textarea"
10+
/>
11+
<span
12+
class="dtc__icon dtc__chat__textarea__send"
13+
>
14+
<svg
15+
fill="none"
16+
height="1em"
17+
viewBox="0 0 24 24"
18+
width="1em"
19+
xmlns="http://www.w3.org/2000/svg"
20+
>
21+
<path
22+
clip-rule="evenodd"
23+
d="M17.999 3.858 3.35 9.204a1.66 1.66 0 0 0-1.095 1.458 1.66 1.66 0 0 0 .862 1.602l4.454 2.44c.27.143.593.098.808-.118l.737-.72 4.508-4.428a.677.677 0 0 1 .952.018c.26.261.26.693-.009.954l-4.562 4.473-.61.603a.68.68 0 0 0-.118.828l2.64 4.626c.315.513.845.81 1.429.81.063 0 .117 0 .18-.009a1.68 1.68 0 0 0 1.41-1.107L20.153 6a1.69 1.69 0 0 0-.404-1.764 1.64 1.64 0 0 0-1.751-.378"
24+
fill="url(#paint0_linear_3878_6538)"
25+
fill-rule="evenodd"
26+
/>
27+
<defs>
28+
<lineargradient
29+
gradientUnits="userSpaceOnUse"
30+
id="paint0_linear_3878_6538"
31+
x1="2.25"
32+
x2="23.921"
33+
y1="3.75"
34+
y2="11.552"
35+
>
36+
<stop
37+
stop-color="#00BAC6"
38+
/>
39+
<stop
40+
offset="0.5"
41+
stop-color="#0067FF"
42+
/>
43+
<stop
44+
offset="1"
45+
stop-color="#450FDE"
46+
/>
47+
</lineargradient>
48+
</defs>
49+
<defs>
50+
<lineargradient
51+
gradientUnits="userSpaceOnUse"
52+
id="paint0_linear_3878_6538_hover"
53+
x1="2.25"
54+
x2="23.921"
55+
y1="3.75"
56+
y2="11.552"
57+
>
58+
<stop
59+
stop-color="#08C4FF"
60+
/>
61+
<stop
62+
offset="0.5"
63+
stop-color="#4892FF"
64+
/>
65+
<stop
66+
offset="1"
67+
stop-color="#8A61FF"
68+
/>
69+
</lineargradient>
70+
</defs>
71+
</svg>
72+
</span>
73+
</div>
874
</DocumentFragment>
975
`;

src/chat/__tests__/__snapshots__/markdown.test.tsx.snap

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ exports[`Test Chat Markdown Match Snapshots: default 1`] = `
88
<h1>
99
title
1010
</h1>
11+
12+
13+
<hr
14+
class="dtc__aigc__markdown__hr"
15+
color="#ebecf0"
16+
/>
1117
</div>
1218
</DocumentFragment>
1319
`;

0 commit comments

Comments
 (0)