Skip to content

test(chat): update tests for chat #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 1 addition & 43 deletions src/chat/__tests__/__snapshots__/content.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Test Chat Content Match snapshot: normal 1`] = `
<DocumentFragment>
<div
class="dtc__aigc__content__container dtc__aigc__content__container--valid"
class="dtc__aigc__content__container"
>
<div
class="dtc__aigc__content__inner__holder"
Expand Down Expand Up @@ -48,48 +48,6 @@ exports[`Test Chat Content Match snapshot: placeholder 1`] = `
<div>
placeholder
</div>
<span
class="dtc__icon"
style="font-size: 200px; position: absolute; right: 0px; bottom: -100px;"
>
<svg
fill="none"
height="1em"
viewBox="0 0 268 265"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
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"
fill="url(#paint0_linear_1290_3143)"
fill-opacity="0.03"
fill-rule="evenodd"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_1290_3143"
x1="0.156"
x2="415.745"
y1="0.938"
y2="225.356"
>
<stop
stop-color="#00BAC6"
/>
<stop
offset="0.5"
stop-color="#0067FF"
/>
<stop
offset="1"
stop-color="#450FDE"
/>
</lineargradient>
</defs>
</svg>
</span>
</div>
</DocumentFragment>
`;
167 changes: 80 additions & 87 deletions src/chat/__tests__/__snapshots__/icon.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test Chat Icon Match Snapshots: AssistantAvatarIcon 1`] = `
<DocumentFragment>
<span
class="dtc__icon"
>
<svg
fill="none"
height="1em"
viewBox="0 0 16 16"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
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"
fill="url(#paint0_linear_5380_77452)"
fill-rule="evenodd"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_5380_77452"
x1="1.88672"
x2="16.6535"
y1="1.85602"
y2="7.14405"
>
<stop
stop-color="#00BAC6"
/>
<stop
offset="0.5"
stop-color="#0067FF"
/>
<stop
offset="1"
stop-color="#450FDE"
/>
</lineargradient>
</defs>
</svg>
</span>
</DocumentFragment>
`;

exports[`Test Chat Icon Match Snapshots: CopyIcon 1`] = `
<DocumentFragment>
<span
Expand Down Expand Up @@ -199,33 +154,32 @@ exports[`Test Chat Icon Match Snapshots: ReloadIcon 1`] = `
</DocumentFragment>
`;

exports[`Test Chat Icon Match Snapshots: RobotIcon 1`] = `
exports[`Test Chat Icon Match Snapshots: SendIcon 1`] = `
<DocumentFragment>
<span
class="dtc__icon"
>
<svg
fill="none"
height="1em"
viewBox="0 0 268 265"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
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"
fill="url(#paint0_linear_1290_3143)"
fill-opacity="0.03"
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"
fill="currentColor"
fill-rule="evenodd"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_1290_3143"
x1="0.156"
x2="415.745"
y1="0.938"
y2="225.356"
id="paint0_linear_3878_6538"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#00BAC6"
Expand All @@ -240,31 +194,28 @@ exports[`Test Chat Icon Match Snapshots: RobotIcon 1`] = `
/>
</lineargradient>
</defs>
</svg>
</span>
</DocumentFragment>
`;

exports[`Test Chat Icon Match Snapshots: SendIcon 1`] = `
<DocumentFragment>
<span
class="dtc__icon"
>
<svg
fill="none"
height="1em"
viewBox="0 0 16 16"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
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"
fill="currentColor"
/>
<path
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"
fill="currentColor"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_3878_6538_hover"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#08C4FF"
/>
<stop
offset="0.5"
stop-color="#4892FF"
/>
<stop
offset="1"
stop-color="#8A61FF"
/>
</lineargradient>
</defs>
</svg>
</span>
</DocumentFragment>
Expand All @@ -278,18 +229,60 @@ exports[`Test Chat Icon Match Snapshots: SendIcon with gradient 1`] = `
<svg
fill="none"
height="1em"
viewBox="0 0 16 16"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
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"
fill="url(#secondary_linear_gradient)"
/>
<path
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"
fill="url(#secondary_linear_gradient)"
clip-rule="evenodd"
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"
fill="url(#paint0_linear_3878_6538)"
fill-rule="evenodd"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_3878_6538"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#00BAC6"
/>
<stop
offset="0.5"
stop-color="#0067FF"
/>
<stop
offset="1"
stop-color="#450FDE"
/>
</lineargradient>
</defs>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_3878_6538_hover"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#08C4FF"
/>
<stop
offset="0.5"
stop-color="#4892FF"
/>
<stop
offset="1"
stop-color="#8A61FF"
/>
</lineargradient>
</defs>
</svg>
</span>
</DocumentFragment>
Expand Down
72 changes: 69 additions & 3 deletions src/chat/__tests__/__snapshots__/input.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,74 @@

exports[`Test Chat Input Match snapshot 1`] = `
<DocumentFragment>
<textarea
class="ant-input aigc-textarea"
/>
<div
class="dtc__chat__textarea__container"
>
<textarea
class="ant-input dtc__chat__textarea"
/>
<span
class="dtc__icon dtc__chat__textarea__send"
>
<svg
fill="none"
height="1em"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
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"
fill="url(#paint0_linear_3878_6538)"
fill-rule="evenodd"
/>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_3878_6538"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#00BAC6"
/>
<stop
offset="0.5"
stop-color="#0067FF"
/>
<stop
offset="1"
stop-color="#450FDE"
/>
</lineargradient>
</defs>
<defs>
<lineargradient
gradientUnits="userSpaceOnUse"
id="paint0_linear_3878_6538_hover"
x1="2.25"
x2="23.921"
y1="3.75"
y2="11.552"
>
<stop
stop-color="#08C4FF"
/>
<stop
offset="0.5"
stop-color="#4892FF"
/>
<stop
offset="1"
stop-color="#8A61FF"
/>
</lineargradient>
</defs>
</svg>
</span>
</div>
</DocumentFragment>
`;
6 changes: 6 additions & 0 deletions src/chat/__tests__/__snapshots__/markdown.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ exports[`Test Chat Markdown Match Snapshots: default 1`] = `
<h1>
title
</h1>


<hr
class="dtc__aigc__markdown__hr"
color="#ebecf0"
/>
</div>
</DocumentFragment>
`;
Expand Down
Loading
Loading