Skip to content

Commit 3c82640

Browse files
committed
feat(chat): tests adjustments
1 parent ae4d4e6 commit 3c82640

File tree

1 file changed

+32
-52
lines changed

1 file changed

+32
-52
lines changed

src/components/chat/chat.spec.ts

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ describe('Chat', () => {
129129
timestamp: new Date(Date.now() - 3400000),
130130
attachments: [
131131
{
132-
id: 'img2',
133-
name: 'img2.png',
134-
url: 'https://www.infragistics.com/angular-demos/assets/images/men/2.jpg',
132+
id: 'file1',
133+
name: 'file1.other',
134+
url: 'http://some-link-to/file1.other',
135135
type: 'file',
136136
},
137137
],
@@ -163,31 +163,27 @@ describe('Chat', () => {
163163

164164
const messageActions = `<div>
165165
<igc-icon-button
166-
collection="material"
167-
id="copy-button"
168-
name="copy"
166+
id="copy_content-button"
167+
name="copy_content"
169168
type="button"
170169
variant="flat"
171170
>
172171
</igc-icon-button>
173172
<igc-icon-button
174-
collection="material"
175-
id="like-button"
176-
name="like"
173+
id="thumb_up_inactive-button"
174+
name="thumb_up_inactive"
177175
type="button"
178176
variant="flat"
179177
>
180178
</igc-icon-button>
181179
<igc-icon-button
182-
collection="material"
183-
id="dislike-button"
184-
name="dislike"
180+
id="thumb_down_inactive-button"
181+
name="thumb_down_inactive"
185182
type="button"
186183
variant="flat"
187184
>
188185
</igc-icon-button>
189186
<igc-icon-button
190-
collection="material"
191187
id="regenerate-button"
192188
name="regenerate"
193189
type="button"
@@ -256,10 +252,9 @@ describe('Chat', () => {
256252
<label for="input_attachments" part="upload-button">
257253
<igc-icon-button
258254
variant="flat"
259-
name="attachment"
255+
name="attach_file"
260256
type="button"
261-
collection="material"
262-
></igc-icon-button>
257+
></igc-icon-button>
263258
<input
264259
type="file"
265260
id="input_attachments"
@@ -270,9 +265,8 @@ describe('Chat', () => {
270265
<igc-icon-button
271266
aria-label="Send message"
272267
part="send-button"
273-
collection="material"
274268
disabled=""
275-
name="send-message"
269+
name="send_message"
276270
type="button"
277271
variant="contained"
278272
>
@@ -459,7 +453,7 @@ describe('Chat', () => {
459453
it('should enable/disable the send button properly', async () => {
460454
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
461455
const sendButton = inputArea?.shadowRoot?.querySelector(
462-
'igc-icon-button[name="send-message"]'
456+
'igc-icon-button[name="send_message"]'
463457
) as HTMLButtonElement;
464458

465459
expect(sendButton?.disabled).to.be.true;
@@ -513,9 +507,8 @@ describe('Chat', () => {
513507
<igc-icon-button
514508
aria-label="Send message"
515509
part="send-button"
516-
collection="material"
517510
disabled=""
518-
name="send-message"
511+
name="send_message"
519512
type="button"
520513
variant="contained"
521514
>
@@ -567,8 +560,7 @@ describe('Chat', () => {
567560
<div part="attachment-wrapper" role="listitem">
568561
<igc-chip removable="">
569562
<igc-icon
570-
collection="material"
571-
name="file-document"
563+
name="attach_document"
572564
slot="prefix"
573565
>
574566
</igc-icon>
@@ -580,8 +572,7 @@ describe('Chat', () => {
580572
<div part="attachment-wrapper" role="listitem">
581573
<igc-chip removable="">
582574
<igc-icon
583-
collection="material"
584-
name="file-image"
575+
name="attach_image"
585576
slot="prefix"
586577
>
587578
</igc-icon>
@@ -603,9 +594,8 @@ describe('Chat', () => {
603594
<label for="input_attachments" part="upload-button">
604595
<igc-icon-button
605596
variant="flat"
606-
name="attachment"
597+
name="attach_file"
607598
type="button"
608-
collection="material"
609599
></igc-icon-button>
610600
<input
611601
type="file"
@@ -617,8 +607,7 @@ describe('Chat', () => {
617607
<igc-icon-button
618608
aria-label="Send message"
619609
part="send-button"
620-
collection="material"
621-
name="send-message"
610+
name="send_message"
622611
type="button"
623612
variant="contained"
624613
>
@@ -689,22 +678,21 @@ describe('Chat', () => {
689678
<div part="attachment-header" role="button">
690679
<div part="details">
691680
<igc-icon
692-
collection="material"
693-
name="file"
681+
name="document_thumbnail"
694682
part="attachment-icon"
695683
>
696684
</igc-icon>
697685
<span part="file-name">
698-
img2.png
686+
file1.other
699687
</span>
700688
</div>
701689
</div>
702690
<div part="attachment-content">
703-
<img
704-
alt="img2.png"
691+
<igc-icon
692+
name="file_generic"
705693
part="file-attachment"
706-
src="http://localhost:8000/src/components/chat/assets/file.png"
707694
>
695+
</igc-icon>
708696
</div>
709697
</div>
710698
</div>`
@@ -752,8 +740,7 @@ describe('Chat', () => {
752740
<igc-list-item>
753741
<span slot="start">
754742
<igc-icon
755-
collection="material"
756-
name="star-icon"
743+
name="auto_suggest"
757744
>
758745
</igc-icon>
759746
</span>
@@ -769,8 +756,7 @@ describe('Chat', () => {
769756
<igc-list-item>
770757
<span slot="start">
771758
<igc-icon
772-
collection="material"
773-
name="star-icon"
759+
name="auto_suggest"
774760
>
775761
</igc-icon>
776762
</span>
@@ -901,10 +887,7 @@ describe('Chat', () => {
901887
return html`
902888
<div slot="suggestion">
903889
<span>${index}. ${suggestion}</span>
904-
<igc-icon
905-
name="good-response"
906-
collection="material"
907-
></igc-icon>
890+
<igc-icon name="good-response"></igc-icon>
908891
</div>
909892
`;
910893
})}
@@ -963,7 +946,6 @@ describe('Chat', () => {
963946
0. Login screen
964947
</span>
965948
<igc-icon
966-
collection="material"
967949
name="good-response"
968950
>
969951
</igc-icon>
@@ -973,7 +955,6 @@ describe('Chat', () => {
973955
1. Registration Form
974956
</span>
975957
<igc-icon
976-
collection="material"
977958
name="good-response"
978959
>
979960
</igc-icon>
@@ -1219,8 +1200,7 @@ describe('Chat', () => {
12191200
part="upload-button"
12201201
>
12211202
<igc-icon-button
1222-
collection="material"
1223-
name="attachment"
1203+
name="attach_file"
12241204
type="button"
12251205
variant="flat"
12261206
>
@@ -1284,7 +1264,7 @@ describe('Chat', () => {
12841264
const eventSpy = spy(chat, 'emitEvent');
12851265
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
12861266
const sendButton = inputArea?.shadowRoot?.querySelector(
1287-
'igc-icon-button[name="send-message"]'
1267+
'igc-icon-button[name="send_message"]'
12881268
)!;
12891269
const textArea = inputArea?.shadowRoot?.querySelector('igc-textarea')!;
12901270
expect(sendButton).not.to.be.null;
@@ -1389,7 +1369,7 @@ describe('Chat', () => {
13891369
await elementUpdated(inputArea!);
13901370

13911371
const sendButton = inputArea?.shadowRoot?.querySelector(
1392-
'igc-icon-button[name="send-message"]'
1372+
'igc-icon-button[name="send_message"]'
13931373
)! as IgcIconButtonComponent;
13941374

13951375
expect(sendButton.disabled).to.be.true;
@@ -1654,19 +1634,19 @@ describe('Chat', () => {
16541634
?.querySelector('igc-chat-message');
16551635

16561636
const likeIcon = messageElement?.shadowRoot?.querySelector(
1657-
'igc-icon-button[name="like"]'
1637+
'igc-icon-button[name="thumb_up_inactive"]'
16581638
) as HTMLElement;
16591639

16601640
simulateClick(likeIcon);
16611641
expect(eventSpy).calledWith('igcMessageReact', {
1662-
detail: { message: messages[0], reaction: 'like' },
1642+
detail: { message: messages[0], reaction: 'thumb_up_inactive' },
16631643
});
16641644
});
16651645

16661646
it('can cancel `igcMessageCreated` event', async () => {
16671647
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
16681648
const sendButton = inputArea?.shadowRoot?.querySelector(
1669-
'igc-icon-button[name="send-message"]'
1649+
'igc-icon-button[name="send_message"]'
16701650
)!;
16711651
const textArea = inputArea?.shadowRoot?.querySelector('igc-textarea')!;
16721652

0 commit comments

Comments
 (0)