@nyaruka/temba-components 0.109.0 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/temba-components.js +361 -354
  3. package/dist/temba-components.js.map +1 -1
  4. package/out-tsc/src/compose/Compose.js +62 -106
  5. package/out-tsc/src/compose/Compose.js.map +1 -1
  6. package/out-tsc/src/contacts/ContactChat.js +64 -59
  7. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  8. package/out-tsc/src/vectoricon/index.js +0 -1
  9. package/out-tsc/src/vectoricon/index.js.map +1 -1
  10. package/out-tsc/test/temba-compose.test.js +24 -440
  11. package/out-tsc/test/temba-compose.test.js.map +1 -1
  12. package/out-tsc/test/temba-contact-chat.test.js +30 -167
  13. package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
  14. package/package.json +1 -1
  15. package/screenshots/truth/compose/attachments-tab.png +0 -0
  16. package/screenshots/truth/compose/attachments-with-failures.png +0 -0
  17. package/screenshots/truth/compose/attachments-with-files-and-failures.png +0 -0
  18. package/screenshots/truth/compose/attachments-with-files-focused.png +0 -0
  19. package/screenshots/truth/compose/attachments-with-files.png +0 -0
  20. package/screenshots/truth/compose/intial-text.png +0 -0
  21. package/screenshots/truth/compose/no-counter.png +0 -0
  22. package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
  23. package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
  24. package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
  25. package/screenshots/truth/contacts/chat-failure.png +0 -0
  26. package/src/compose/Compose.ts +69 -103
  27. package/src/contacts/ContactChat.ts +69 -70
  28. package/src/untyped.d.ts +1 -1
  29. package/src/vectoricon/index.ts +0 -1
  30. package/test/temba-compose.test.ts +29 -590
  31. package/test/temba-contact-chat.test.ts +30 -263
  32. package/web-test-runner.config.mjs +1 -0
  33. package/screenshots/truth/compose/attachments-and-send-button.png +0 -0
  34. package/screenshots/truth/compose/attachments-no-send-button.png +0 -0
  35. package/screenshots/truth/compose/attachments-with-all-files-and-click-send.png +0 -0
  36. package/screenshots/truth/compose/attachments-with-all-files.png +0 -0
  37. package/screenshots/truth/compose/attachments-with-failure-files.png +0 -0
  38. package/screenshots/truth/compose/attachments-with-success-files-and-click-send.png +0 -0
  39. package/screenshots/truth/compose/attachments-with-success-files.png +0 -0
  40. package/screenshots/truth/compose/chatbox-attachments-counter-and-send-button.png +0 -0
  41. package/screenshots/truth/compose/chatbox-attachments-counter-no-send-button.png +0 -0
  42. package/screenshots/truth/compose/chatbox-attachments-no-counter-and-send-button.png +0 -0
  43. package/screenshots/truth/compose/chatbox-attachments-no-counter-no-send-button.png +0 -0
  44. package/screenshots/truth/compose/chatbox-counter-and-send-button.png +0 -0
  45. package/screenshots/truth/compose/chatbox-counter-no-send-button.png +0 -0
  46. package/screenshots/truth/compose/chatbox-no-counter-and-send-button.png +0 -0
  47. package/screenshots/truth/compose/chatbox-no-counter-no-send-button.png +0 -0
  48. package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files-and-click-send.png +0 -0
  49. package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files.png +0 -0
  50. package/screenshots/truth/compose/chatbox-no-text-attachments-with-failure-files.png +0 -0
  51. package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files-and-click-send.png +0 -0
  52. package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files.png +0 -0
  53. package/screenshots/truth/compose/chatbox-with-text-and-click-send.png +0 -0
  54. package/screenshots/truth/compose/chatbox-with-text-and-hit-enter.png +0 -0
  55. package/screenshots/truth/compose/chatbox-with-text-and-spaces.png +0 -0
  56. package/screenshots/truth/compose/chatbox-with-text-and-url.png +0 -0
  57. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-click-send.png +0 -0
  58. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-hit-enter.png +0 -0
  59. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files.png +0 -0
  60. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-click-send.png +0 -0
  61. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-hit-enter.png +0 -0
  62. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files.png +0 -0
  63. package/screenshots/truth/compose/chatbox-with-text-attachments-with-failure-files.png +0 -0
  64. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-click-send.png +0 -0
  65. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-hit-enter.png +0 -0
  66. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files.png +0 -0
  67. package/screenshots/truth/compose/chatbox-with-text-no-spaces.png +0 -0
  68. package/screenshots/truth/compose/chatbox-with-text.png +0 -0
  69. package/screenshots/truth/contacts/compose-attachments-no-text-failure.png +0 -0
  70. package/screenshots/truth/contacts/compose-text-and-attachments-failure-attachments.png +0 -0
  71. package/screenshots/truth/contacts/compose-text-and-attachments-failure-generic.png +0 -0
  72. package/screenshots/truth/contacts/compose-text-and-attachments-failure-text-and-attachments.png +0 -0
  73. package/screenshots/truth/contacts/compose-text-and-attachments-failure-text.png +0 -0
  74. package/screenshots/truth/contacts/compose-text-no-attachments-failure.png +0 -0
  75. package/screenshots/truth/contacts/compose-text-no-attachments-success.png +0 -0
  76. /package/screenshots/truth/contacts/{compose-attachments-no-text-success.png → chat-for-active-contact.png} +0 -0
  77. /package/screenshots/truth/contacts/{contact-archived-hide-chatbox.png → chat-for-archived-contact.png} +0 -0
  78. /package/screenshots/truth/contacts/{contact-blocked-hide-chatbox.png → chat-for-blocked-contact.png} +0 -0
  79. /package/screenshots/truth/contacts/{contact-stopped-hide-chatbox.png → chat-for-stopped-contact.png} +0 -0
  80. /package/screenshots/truth/contacts/{compose-text-and-attachments-success.png → chat-sends-attachments-only.png} +0 -0
  81. /package/screenshots/truth/contacts/{contact-active-default.png → chat-sends-text-and-attachments.png} +0 -0
  82. /package/screenshots/truth/contacts/{contact-active-show-chatbox.png → chat-sends-text-only.png} +0 -0
@@ -31,10 +31,6 @@ const getComposeValue = (value) => {
31
31
  export const getValidText = () => {
32
32
  return 'sà-wàd-dee!';
33
33
  };
34
- // for a server limit of 640 chars, return a string that is 640+ chars
35
- export const getInvalidText = () => {
36
- return "p}h<r0P<?SCIbV1+pwW1Hj8g^J&=Sm2f)K=5LjFFUZ№5@ybpoLZ7DJ(27qdWxQMaO)I1nB4(D%d3c(H)QXOF6F?4>&d{lhd5?0`Lio!yAGMO№*AxN5{z5s.IO*dy?tm}vXJ#Lf-HlD;xmNp}0<P42=w#ll9)B-e9>Q#'{~Vp<dl:xC9`T^lhh@TosCZ^:(H<Ji<E(~PojvYk^rPB+poYy^Ne~Su1:9?IgH'4S5Q9v0g№FEIUc~!{S7;746j'Sd@Nfu3=x?CsuR;YLP4j+AOzDARZG?0(Ji(NMg=r%n0Fq?R1?E%Yf`bcoVZAJ^bl0J'^@;lH>T.HmxYxwS;1?(bfrh?pRdd73:iMxrfx5luQ(}<dCD1b3g'G0CtkB№;8KkbL=>krG{RO%Va4wwr%P>jE*+n(E11}Ju9#<.f^)<MTH09^b{RQv7~H`#@Hda6{MV&H@xdyEKq#M@nZng8WTU66!F@*!)w*EpQ+65XKuQCaESgq=PHmtqi@l;F?PHvl^g@Z:+}}Xyr`IC2=3?20^I'qSU*tkyinM^JF.ZI>}~XzRQJn№v3o-w?Vy&gC:c.l(&9{`M#-'N}{T#7lw8(4:iY621'>C^.&hVZn:R!G}Ek){D#'KkiJWawq#7~GLBN*?V!ncw)d%&(tXj";
37
- };
38
34
  // valid = attachments that are uploaded sent to the server when the user clicks send
39
35
  export const getValidAttachments = (numFiles = 2) => {
40
36
  const attachments = [];
@@ -55,30 +51,6 @@ export const getValidAttachments = (numFiles = 2) => {
55
51
  }
56
52
  return attachments;
57
53
  };
58
- // invalid = attachments that are not uploaded and are not sent to the server when the user clicks send
59
- export const getInvalidAttachments = () => {
60
- const f1 = 'f1';
61
- const fail1 = {
62
- uuid: f1,
63
- content_type: 'image/png',
64
- type: 'image/png',
65
- filename: 'name_' + f1,
66
- url: 'url_' + f1,
67
- size: 26624,
68
- error: 'Limit for file uploads is 25.0 MB'
69
- };
70
- const f2 = 'f2';
71
- const fail2 = {
72
- uuid: f2,
73
- content_type: 'application/octet-stream',
74
- type: 'application/octet-stream',
75
- filename: 'name_' + f2,
76
- url: 'url_' + f2,
77
- size: 1024,
78
- error: 'Unsupported file type'
79
- };
80
- return [fail1, fail2];
81
- };
82
54
  // for a test width of 500, return a string that is 60+ chars with spaces
83
55
  // to test that line breaks / word wrapping works as expected
84
56
  const getValidText_Long_WithSpaces = () => {
@@ -103,65 +75,24 @@ describe('temba-compose chatbox', () => {
103
75
  assert.instanceOf(compose, Compose);
104
76
  expect(compose.endpoint).equals(DEFAULT_MEDIA_ENDPOINT);
105
77
  });
106
- it('chatbox no counter no send button', async () => {
78
+ it('no counter', async () => {
107
79
  const compose = await getCompose({
108
80
  chatbox: true
109
81
  });
110
- await assertScreenshot('compose/chatbox-no-counter-no-send-button', getClip(compose));
111
- });
112
- it('chatbox no counter and send button', async () => {
113
- const compose = await getCompose({
114
- chatbox: true,
115
- button: true
116
- });
117
- await assertScreenshot('compose/chatbox-no-counter-and-send-button', getClip(compose));
82
+ await assertScreenshot('compose/no-counter', getClip(compose));
118
83
  });
119
- it('chatbox counter no send button', async () => {
84
+ it('initializes with text', async () => {
120
85
  const compose = await getCompose({
121
- chatbox: true,
122
86
  counter: true
123
87
  });
124
- await assertScreenshot('compose/chatbox-counter-no-send-button', getClip(compose));
125
- });
126
- it('chatbox counter and send button', async () => {
127
- const compose = await getCompose({
128
- chatbox: true,
129
- counter: true,
130
- button: true
131
- });
132
- await assertScreenshot('compose/chatbox-counter-and-send-button', getClip(compose));
133
- });
134
- it('chatbox counter and send button deserialize and serialize', async () => {
135
- const initialValue = getInitialValue();
136
- const composeValue = getComposeValue(initialValue);
137
- const compose = await getCompose({
138
- chatbox: true,
139
- counter: true,
140
- button: true,
141
- value: composeValue
142
- });
143
- // deserialize
144
- expect(compose.currentText).to.equal('');
145
- expect(compose.currentAttachments).to.deep.equal([]);
146
- // serialize
147
- expect(compose.value).to.equal('{}');
148
- });
149
- it('chatbox with text', async () => {
150
- const compose = await getCompose({
151
- chatbox: true,
152
- counter: true,
153
- button: true
154
- });
155
88
  await updateComponent(compose, getValidText());
156
- await assertScreenshot('compose/chatbox-with-text', getClip(compose));
89
+ await assertScreenshot('compose/intial-text', getClip(compose));
157
90
  });
158
- it('chatbox with text deserialize and serialize', async () => {
91
+ it('serializes', async () => {
159
92
  const initialValue = getInitialValue(getValidText());
160
93
  const composeValue = getComposeValue(initialValue);
161
94
  const compose = await getCompose({
162
- chatbox: true,
163
95
  counter: true,
164
- button: true,
165
96
  value: composeValue
166
97
  });
167
98
  // deserialize
@@ -170,266 +101,52 @@ describe('temba-compose chatbox', () => {
170
101
  // serialize
171
102
  expect(compose.value).to.equal(composeValue);
172
103
  });
173
- it('chatbox with text and spaces', async () => {
104
+ // TODO: these are better suited for textinput tests
105
+ it('wraps text and spaces', async () => {
174
106
  const compose = await getCompose({
175
- chatbox: true,
176
- counter: true,
177
- button: true
107
+ counter: true
178
108
  });
179
109
  await updateComponent(compose, getValidText_Long_WithSpaces());
180
- await assertScreenshot('compose/chatbox-with-text-and-spaces', getClip(compose));
110
+ await assertScreenshot('compose/wraps-text-and-spaces', getClip(compose));
181
111
  });
182
- it('chatbox with text and no spaces', async () => {
112
+ it('wraps text and no spaces', async () => {
183
113
  const compose = await getCompose({
184
- chatbox: true,
185
- counter: true,
186
- button: true
114
+ counter: true
187
115
  });
188
116
  await updateComponent(compose, getValidText_Long_WithNoSpaces());
189
- await assertScreenshot('compose/chatbox-with-text-no-spaces', getClip(compose));
117
+ await assertScreenshot('compose/wraps-text-no-spaces', getClip(compose));
190
118
  });
191
- it('chatbox with text and url', async () => {
119
+ it('wraps with text and url', async () => {
192
120
  const compose = await getCompose({
193
- chatbox: true,
194
- counter: true,
195
- button: true
121
+ counter: true
196
122
  });
197
123
  await updateComponent(compose, getValidText_Long_WithUrl());
198
- await assertScreenshot('compose/chatbox-with-text-and-url', getClip(compose));
199
- });
200
- it('chatbox with text and click send', async () => {
201
- const compose = await getCompose({
202
- chatbox: true,
203
- counter: true,
204
- button: true
205
- });
206
- await updateComponent(compose, getValidText());
207
- // press enter
208
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
209
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
210
- await assertScreenshot('compose/chatbox-with-text-and-click-send', getClip(compose));
211
- });
212
- it('chatbox with text and hit enter', async () => {
213
- const compose = await getCompose({
214
- chatbox: true,
215
- counter: true,
216
- button: true
217
- });
218
- await updateComponent(compose, getValidText());
219
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
220
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
221
- await assertScreenshot('compose/chatbox-with-text-and-hit-enter', getClip(compose));
124
+ await assertScreenshot('compose/wraps-text-and-url', getClip(compose));
222
125
  });
223
126
  });
224
127
  describe('temba-compose attachments', () => {
225
- it('attachments no send button', async () => {
128
+ it('supports attachments tab', async () => {
226
129
  const compose = await getCompose({
227
130
  attachments: true
228
131
  });
229
- await assertScreenshot('compose/attachments-no-send-button', getClip(compose));
132
+ await assertScreenshot('compose/attachments-tab', getClip(compose));
230
133
  });
231
- it('attachments and send button', async () => {
134
+ it('shows valid attachments', async () => {
232
135
  const compose = await getCompose({
233
- attachments: true,
234
- button: true
235
- });
236
- await assertScreenshot('compose/attachments-and-send-button', getClip(compose));
237
- });
238
- it('attachments and send button deserialize and serialize', async () => {
239
- const initialValue = getInitialValue();
240
- const composeValue = getComposeValue(initialValue);
241
- const compose = await getCompose({
242
- attachments: true,
243
- button: true,
244
- value: composeValue
245
- });
246
- // deserialize
247
- expect(compose.currentText).to.equal('');
248
- expect(compose.currentAttachments).to.deep.equal([]);
249
- // serialize
250
- expect(compose.value).to.equal('{}');
251
- });
252
- it('attachments with success uploaded files', async () => {
253
- const compose = await getCompose({
254
- attachments: true,
255
- button: true
256
- });
257
- await updateComponent(compose, null, getValidAttachments());
258
- await assertScreenshot('compose/attachments-with-success-files', getClip(compose));
259
- });
260
- it('attachments with success uploaded files deserialize and serialize', async () => {
261
- const initialValue = getInitialValue(null, getValidAttachments());
262
- const composeValue = getComposeValue(initialValue);
263
- const compose = await getCompose({
264
- attachments: true,
265
- button: true,
266
- value: composeValue
267
- });
268
- // deserialize
269
- expect(compose.currentText).to.equal('');
270
- expect(compose.currentAttachments).to.deep.equal(getValidAttachments());
271
- // serialize
272
- expect(compose.value).to.equal(composeValue);
273
- });
274
- it('attachments with failure uploaded files', async () => {
275
- const compose = await getCompose({
276
- attachments: true,
277
- button: true
278
- });
279
- await updateComponent(compose, null, null);
280
- await assertScreenshot('compose/attachments-with-failure-files', getClip(compose));
281
- });
282
- it('attachments with success and failure uploaded files', async () => {
283
- const compose = await getCompose({
284
- attachments: true,
285
- button: true
286
- });
287
- await updateComponent(compose, null, getValidAttachments());
288
- await assertScreenshot('compose/attachments-with-all-files', getClip(compose));
289
- });
290
- it('attachments with success uploaded files and click send', async () => {
291
- const compose = await getCompose({
292
- attachments: true,
293
- chatbox: true
294
- });
295
- await updateComponent(compose, null, getValidAttachments());
296
- // press enter
297
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
298
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
299
- await assertScreenshot('compose/attachments-with-success-files-and-click-send', getClip(compose));
300
- });
301
- it('attachments with success and failure uploaded files and click send', async () => {
302
- const compose = await getCompose({
303
- attachments: true,
304
- chatbox: true
305
- });
306
- await updateComponent(compose, null, getValidAttachments());
307
- // press enter
308
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
309
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
310
- await assertScreenshot('compose/attachments-with-all-files-and-click-send', getClip(compose));
311
- });
312
- });
313
- describe('temba-compose chatbox and attachments', () => {
314
- it('chatbox and attachments no counter no send button', async () => {
315
- const compose = await getCompose({
316
- chatbox: true,
317
136
  attachments: true
318
137
  });
319
- await assertScreenshot('compose/chatbox-attachments-no-counter-no-send-button', getClip(compose));
320
- });
321
- it('chatbox and attachments no counter and send button', async () => {
322
- const compose = await getCompose({
323
- chatbox: true,
324
- attachments: true,
325
- button: true
326
- });
327
- await assertScreenshot('compose/chatbox-attachments-no-counter-and-send-button', getClip(compose));
328
- });
329
- it('chatbox and attachments counter no send button', async () => {
330
- const compose = await getCompose({
331
- chatbox: true,
332
- attachments: true,
333
- counter: true
334
- });
335
- await assertScreenshot('compose/chatbox-attachments-counter-no-send-button', getClip(compose));
336
- });
337
- it('chatbox and attachments counter and send button', async () => {
338
- const compose = await getCompose({
339
- chatbox: true,
340
- attachments: true,
341
- counter: true,
342
- button: true
343
- });
344
- await assertScreenshot('compose/chatbox-attachments-counter-and-send-button', getClip(compose));
345
- });
346
- it('chatbox and attachments counter and send button deserialize and serialize', async () => {
347
- const initialValue = getInitialValue();
348
- const composeValue = getComposeValue(initialValue);
349
- const compose = await getCompose({
350
- chatbox: true,
351
- attachments: true,
352
- counter: true,
353
- button: true,
354
- value: composeValue
355
- });
356
- // deserialize
357
- expect(compose.currentText).to.equal('');
358
- expect(compose.currentAttachments).to.deep.equal([]);
359
- // serialize
360
- expect(compose.value).to.equal('{}');
361
- });
362
- });
363
- describe('temba-compose chatbox with text and attachments no files', () => {
364
- it('chatbox with text, attachments no files', async () => {
365
- const compose = await getCompose({
366
- chatbox: true,
367
- attachments: true,
368
- counter: true,
369
- button: true
370
- });
371
- updateComponent(compose, getValidText());
372
- await assertScreenshot('compose/chatbox-with-text-attachments-no-files', getClip(compose));
373
- });
374
- it('chatbox with text, attachments no files deserialize and serialize', async () => {
375
- const initialValue = getInitialValue(getValidText());
376
- const composeValue = getComposeValue(initialValue);
377
- const compose = await getCompose({
378
- chatbox: true,
379
- attachments: true,
380
- counter: true,
381
- button: true,
382
- value: composeValue
383
- });
384
- // deserialize
385
- expect(compose.currentText).to.equal(getValidText());
386
- expect(compose.currentAttachments).to.deep.equal([]);
387
- // serialize
388
- expect(compose.value).to.equal(composeValue);
389
- });
390
- it('chatbox with text, attachments no files, and click send', async () => {
391
- const compose = await getCompose({
392
- chatbox: true,
393
- attachments: true,
394
- counter: true,
395
- button: true
396
- });
397
- updateComponent(compose, getValidText());
398
- // press enter
399
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
400
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
401
- await assertScreenshot('compose/chatbox-with-text-attachments-no-files-and-click-send', getClip(compose));
402
- });
403
- it('chatbox with text, attachments no files, and hit enter', async () => {
404
- const compose = await getCompose({
405
- chatbox: true,
406
- attachments: true,
407
- counter: true,
408
- button: true
409
- });
410
- await updateComponent(compose, getValidText());
411
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
412
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
413
- await assertScreenshot('compose/chatbox-with-text-attachments-no-files-and-hit-enter', getClip(compose));
414
- });
415
- });
416
- describe('temba-compose chatbox no text and attachments with files', () => {
417
- it('chatbox no text, attachments with success uploaded files', async () => {
418
- const compose = await getCompose({
419
- chatbox: true,
420
- attachments: true,
421
- button: true
422
- });
423
138
  await updateComponent(compose, null, getValidAttachments());
424
- await assertScreenshot('compose/chatbox-no-text-attachments-with-success-files', getClip(compose));
139
+ await assertScreenshot('compose/attachments-with-files', getClip(compose));
140
+ // click on tab
141
+ const tabs = compose.getTabs();
142
+ tabs.focusTab('Attachments');
143
+ await assertScreenshot('compose/attachments-with-files-focused', getClip(compose));
425
144
  });
426
- it('chatbox no text, attachments with success uploaded files deserialize and serialize', async () => {
145
+ it('serializes attachments', async () => {
427
146
  const initialValue = getInitialValue(null, getValidAttachments());
428
147
  const composeValue = getComposeValue(initialValue);
429
148
  const compose = await getCompose({
430
- chatbox: true,
431
149
  attachments: true,
432
- button: true,
433
150
  value: composeValue
434
151
  });
435
152
  // deserialize
@@ -438,138 +155,5 @@ describe('temba-compose chatbox no text and attachments with files', () => {
438
155
  // serialize
439
156
  expect(compose.value).to.equal(composeValue);
440
157
  });
441
- it('chatbox no text, attachments with failure uploaded files', async () => {
442
- const compose = await getCompose({
443
- chatbox: true,
444
- attachments: true,
445
- button: true
446
- });
447
- await updateComponent(compose, null, null);
448
- await assertScreenshot('compose/chatbox-no-text-attachments-with-failure-files', getClip(compose));
449
- });
450
- it('chatbox no text, attachments with success and failure uploaded files', async () => {
451
- const compose = await getCompose({
452
- chatbox: true,
453
- attachments: true,
454
- button: true
455
- });
456
- await updateComponent(compose, null, getValidAttachments());
457
- await assertScreenshot('compose/chatbox-no-text-attachments-with-all-files', getClip(compose));
458
- });
459
- it('chatbox no text, attachments with success uploaded files, and click send', async () => {
460
- const compose = await getCompose({
461
- chatbox: true,
462
- attachments: true,
463
- button: true
464
- });
465
- await updateComponent(compose, null, getValidAttachments());
466
- // press enter
467
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
468
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
469
- await assertScreenshot('compose/chatbox-no-text-attachments-with-success-files-and-click-send', getClip(compose));
470
- });
471
- it('chatbox no text, attachments with success and failure uploaded files, and click send', async () => {
472
- const compose = await getCompose({
473
- chatbox: true,
474
- attachments: true,
475
- button: true
476
- });
477
- await updateComponent(compose, null, getValidAttachments());
478
- // press enter
479
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
480
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
481
- await assertScreenshot('compose/chatbox-no-text-attachments-with-all-files-and-click-send', getClip(compose));
482
- });
483
- });
484
- describe('temba-compose chatbox with text and attachments with files', () => {
485
- it('chatbox with text, attachments with success uploaded files', async () => {
486
- const compose = await getCompose({
487
- chatbox: true,
488
- attachments: true,
489
- button: true
490
- });
491
- await updateComponent(compose, getValidText(), getValidAttachments());
492
- await assertScreenshot('compose/chatbox-with-text-attachments-with-success-files', getClip(compose));
493
- });
494
- it('chatbox with text, attachments with success uploaded files deserialize and serialize', async () => {
495
- const initialValue = getInitialValue(getValidText(), getValidAttachments());
496
- const composeValue = getComposeValue(initialValue);
497
- const compose = await getCompose({
498
- chatbox: true,
499
- attachments: true,
500
- button: true,
501
- value: composeValue
502
- });
503
- // deserialize
504
- expect(compose.currentText).to.equal(getValidText());
505
- expect(compose.currentAttachments).to.deep.equal(getValidAttachments());
506
- // serialize
507
- expect(compose.value).to.equal(composeValue);
508
- });
509
- it('chatbox with text, attachments with failure uploaded files', async () => {
510
- const compose = await getCompose({
511
- chatbox: true,
512
- attachments: true,
513
- button: true
514
- });
515
- await updateComponent(compose, getValidText(), null);
516
- await assertScreenshot('compose/chatbox-with-text-attachments-with-failure-files', getClip(compose));
517
- });
518
- it('chatbox with text, attachments with success and failure uploaded files', async () => {
519
- const compose = await getCompose({
520
- chatbox: true,
521
- attachments: true,
522
- button: true
523
- });
524
- await updateComponent(compose, getValidText(), getValidAttachments());
525
- await assertScreenshot('compose/chatbox-with-text-attachments-with-all-files', getClip(compose));
526
- });
527
- it('chatbox with text, attachments with success uploaded files, and click send', async () => {
528
- const compose = await getCompose({
529
- chatbox: true,
530
- attachments: true,
531
- button: true
532
- });
533
- await updateComponent(compose, getValidText(), getValidAttachments());
534
- // press enter
535
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
536
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
537
- await assertScreenshot('compose/chatbox-with-text-attachments-with-success-files-and-click-send', getClip(compose));
538
- });
539
- it('chatbox with text, attachments with success and failure uploaded files, and click send', async () => {
540
- const compose = await getCompose({
541
- chatbox: true,
542
- attachments: true,
543
- button: true
544
- });
545
- await updateComponent(compose, getValidText(), getValidAttachments());
546
- // press enter
547
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
548
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
549
- await assertScreenshot('compose/chatbox-with-text-attachments-with-all-files-and-click-send', getClip(compose));
550
- });
551
- it('chatbox with text, attachments with success uploaded files, and hit enter', async () => {
552
- const compose = await getCompose({
553
- chatbox: true,
554
- attachments: true,
555
- button: true
556
- });
557
- await updateComponent(compose, getValidText(), getValidAttachments());
558
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
559
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
560
- await assertScreenshot('compose/chatbox-with-text-attachments-with-success-files-and-hit-enter', getClip(compose));
561
- });
562
- it('chatbox with text, attachments with success and failure uploaded files, and hit enter', async () => {
563
- const compose = await getCompose({
564
- chatbox: true,
565
- attachments: true,
566
- button: true
567
- });
568
- await updateComponent(compose, getValidText(), getValidAttachments());
569
- const chatbox = compose.shadowRoot.querySelector('.chatbox');
570
- chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
571
- const newClip = getClip(compose);
572
- await assertScreenshot('compose/chatbox-with-text-attachments-with-all-files-and-hit-enter', newClip);
573
- });
574
158
  });
575
159
  //# sourceMappingURL=temba-compose.test.js.map