@nyaruka/temba-components 0.86.0 → 0.87.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.
- package/.eslintrc.js +3 -3
- package/.prettierrc +6 -0
- package/.storybook/main.js +3 -3
- package/.storybook/preview.js +2 -2
- package/CHANGELOG.md +14 -0
- package/CreateIncludesPlugin.js +2 -2
- package/demo/index.html +1 -0
- package/dist/locales/es.js +1 -1
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +296 -277
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/RapidElement.js +3 -3
- package/out-tsc/src/RapidElement.js.map +1 -1
- package/out-tsc/src/ResizeElement.js +2 -2
- package/out-tsc/src/ResizeElement.js.map +1 -1
- package/out-tsc/src/aliaseditor/AliasEditor.js +1 -1
- package/out-tsc/src/aliaseditor/AliasEditor.js.map +1 -1
- package/out-tsc/src/button/Button.js +1 -1
- package/out-tsc/src/button/Button.js.map +1 -1
- package/out-tsc/src/charcount/helpers.js +1 -1
- package/out-tsc/src/charcount/helpers.js.map +1 -1
- package/out-tsc/src/colorpicker/ColorPicker.js +4 -4
- package/out-tsc/src/colorpicker/ColorPicker.js.map +1 -1
- package/out-tsc/src/completion/Completion.js +2 -2
- package/out-tsc/src/completion/Completion.js.map +1 -1
- package/out-tsc/src/completion/ExcellentParser.js +1 -1
- package/out-tsc/src/completion/ExcellentParser.js.map +1 -1
- package/out-tsc/src/completion/helpers.js +8 -8
- package/out-tsc/src/completion/helpers.js.map +1 -1
- package/out-tsc/src/compose/Compose.js +14 -14
- package/out-tsc/src/compose/Compose.js.map +1 -1
- package/out-tsc/src/contacts/ContactBadges.js +2 -2
- package/out-tsc/src/contacts/ContactBadges.js.map +1 -1
- package/out-tsc/src/contacts/ContactChat.js +4 -4
- package/out-tsc/src/contacts/ContactChat.js.map +1 -1
- package/out-tsc/src/contacts/ContactDetails.js +4 -4
- package/out-tsc/src/contacts/ContactDetails.js.map +1 -1
- package/out-tsc/src/contacts/ContactFieldEditor.js +3 -3
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/contacts/ContactFields.js +2 -2
- package/out-tsc/src/contacts/ContactFields.js.map +1 -1
- package/out-tsc/src/contacts/ContactHistory.js +21 -19
- package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
- package/out-tsc/src/contacts/ContactPending.js +4 -4
- package/out-tsc/src/contacts/ContactPending.js.map +1 -1
- package/out-tsc/src/contacts/ContactTickets.js +8 -8
- package/out-tsc/src/contacts/ContactTickets.js.map +1 -1
- package/out-tsc/src/contacts/events.js +2 -2
- package/out-tsc/src/contacts/events.js.map +1 -1
- package/out-tsc/src/contacts/helpers.js +2 -2
- package/out-tsc/src/contacts/helpers.js.map +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js +7 -7
- package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
- package/out-tsc/src/date/TembaDate.js +1 -1
- package/out-tsc/src/date/TembaDate.js.map +1 -1
- package/out-tsc/src/datepicker/DatePicker.js +1 -1
- package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
- package/out-tsc/src/dialog/Dialog.js +5 -5
- package/out-tsc/src/dialog/Dialog.js.map +1 -1
- package/out-tsc/src/dialog/Modax.js +8 -8
- package/out-tsc/src/dialog/Modax.js.map +1 -1
- package/out-tsc/src/dropdown/Dropdown.js +1 -1
- package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
- package/out-tsc/src/fields/FieldManager.js +6 -6
- package/out-tsc/src/fields/FieldManager.js.map +1 -1
- package/out-tsc/src/imagepicker/ImagePicker.js +4 -4
- package/out-tsc/src/imagepicker/ImagePicker.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/label/Label.js +1 -1
- package/out-tsc/src/label/Label.js.map +1 -1
- package/out-tsc/src/leafletmap/LeafletMap.js +6 -6
- package/out-tsc/src/leafletmap/LeafletMap.js.map +1 -1
- package/out-tsc/src/leafletmap/helpers.js +2 -2
- package/out-tsc/src/leafletmap/helpers.js.map +1 -1
- package/out-tsc/src/lightbox/Lightbox.js +2 -2
- package/out-tsc/src/lightbox/Lightbox.js.map +1 -1
- package/out-tsc/src/list/ContentMenu.js +8 -8
- package/out-tsc/src/list/ContentMenu.js.map +1 -1
- package/out-tsc/src/list/NotificationList.js +7 -3
- package/out-tsc/src/list/NotificationList.js.map +1 -1
- package/out-tsc/src/list/RunList.js +1 -1
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +6 -6
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/list/TembaList.js +5 -5
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/out-tsc/src/list/TembaMenu.js +22 -22
- package/out-tsc/src/list/TembaMenu.js.map +1 -1
- package/out-tsc/src/loading/Loading.js +1 -1
- package/out-tsc/src/loading/Loading.js.map +1 -1
- package/out-tsc/src/locales/es.js +1 -1
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +1 -1
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/pt.js +1 -1
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/omnibox/Omnibox.js +1 -1
- package/out-tsc/src/omnibox/Omnibox.js.map +1 -1
- package/out-tsc/src/options/Options.js +9 -9
- package/out-tsc/src/options/Options.js.map +1 -1
- package/out-tsc/src/remote/Remote.js +1 -1
- package/out-tsc/src/remote/Remote.js.map +1 -1
- package/out-tsc/src/select/Select.js +18 -18
- package/out-tsc/src/select/Select.js.map +1 -1
- package/out-tsc/src/sms/gsmsplitter.js +8 -8
- package/out-tsc/src/sms/gsmsplitter.js.map +1 -1
- package/out-tsc/src/sms/gsmvalidator.js +1 -1
- package/out-tsc/src/sms/gsmvalidator.js.map +1 -1
- package/out-tsc/src/sms/index.js +2 -2
- package/out-tsc/src/sms/index.js.map +1 -1
- package/out-tsc/src/sms/unicodesplitter.js +8 -8
- package/out-tsc/src/sms/unicodesplitter.js.map +1 -1
- package/out-tsc/src/store/Store.js +10 -10
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/store/StoreElement.js +2 -2
- package/out-tsc/src/store/StoreElement.js.map +1 -1
- package/out-tsc/src/tabpane/TabPane.js +4 -4
- package/out-tsc/src/tabpane/TabPane.js.map +1 -1
- package/out-tsc/src/templates/TemplateEditor.js +9 -9
- package/out-tsc/src/templates/TemplateEditor.js.map +1 -1
- package/out-tsc/src/textinput/TextInput.js +1 -1
- package/out-tsc/src/textinput/TextInput.js.map +1 -1
- package/out-tsc/src/thumbnail/Thumbnail.js +5 -5
- package/out-tsc/src/thumbnail/Thumbnail.js.map +1 -1
- package/out-tsc/src/tip/Tip.js +3 -3
- package/out-tsc/src/tip/Tip.js.map +1 -1
- package/out-tsc/src/utils/index.js +21 -21
- package/out-tsc/src/utils/index.js.map +1 -1
- package/out-tsc/src/vectoricon/VectorIcon.js +2 -2
- package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
- package/out-tsc/src/vectoricon/index.js +2 -0
- package/out-tsc/src/vectoricon/index.js.map +1 -1
- package/out-tsc/src/webchat/WebChat.js +234 -81
- package/out-tsc/src/webchat/WebChat.js.map +1 -1
- package/out-tsc/src/webchat/assets.js +2 -0
- package/out-tsc/src/webchat/assets.js.map +1 -0
- package/out-tsc/src/webchat/index.js.map +1 -1
- package/out-tsc/test/temba-alert.test.js +1 -1
- package/out-tsc/test/temba-alert.test.js.map +1 -1
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-color-picker.test.js +4 -4
- package/out-tsc/test/temba-color-picker.test.js.map +1 -1
- package/out-tsc/test/temba-compose.test.js +50 -54
- package/out-tsc/test/temba-compose.test.js.map +1 -1
- package/out-tsc/test/temba-contact-badges.test.js +2 -2
- package/out-tsc/test/temba-contact-badges.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +25 -38
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-contact-details.test.js +2 -2
- package/out-tsc/test/temba-contact-details.test.js.map +1 -1
- package/out-tsc/test/temba-contact-fields.test.js +4 -4
- package/out-tsc/test/temba-contact-fields.test.js.map +1 -1
- package/out-tsc/test/temba-contact-history.test.js +3 -3
- package/out-tsc/test/temba-contact-history.test.js.map +1 -1
- package/out-tsc/test/temba-contact-search.test.js +7 -7
- package/out-tsc/test/temba-contact-search.test.js.map +1 -1
- package/out-tsc/test/temba-contact-tickets.test.js +3 -3
- package/out-tsc/test/temba-contact-tickets.test.js.map +1 -1
- package/out-tsc/test/temba-content-menu.test.js +7 -7
- package/out-tsc/test/temba-content-menu.test.js.map +1 -1
- package/out-tsc/test/temba-date.test.js +3 -3
- package/out-tsc/test/temba-date.test.js.map +1 -1
- package/out-tsc/test/temba-datepicker.test.js +1 -1
- package/out-tsc/test/temba-datepicker.test.js.map +1 -1
- package/out-tsc/test/temba-field-manager.test.js +1 -3
- package/out-tsc/test/temba-field-manager.test.js.map +1 -1
- package/out-tsc/test/temba-label.test.js +6 -6
- package/out-tsc/test/temba-label.test.js.map +1 -1
- package/out-tsc/test/temba-lightbox.test.js +2 -2
- package/out-tsc/test/temba-lightbox.test.js.map +1 -1
- package/out-tsc/test/temba-list.test.js +6 -6
- package/out-tsc/test/temba-list.test.js.map +1 -1
- package/out-tsc/test/temba-menu.test.js +4 -5
- package/out-tsc/test/temba-menu.test.js.map +1 -1
- package/out-tsc/test/temba-modax.test.js +3 -3
- package/out-tsc/test/temba-modax.test.js.map +1 -1
- package/out-tsc/test/temba-options.test.js +1 -1
- package/out-tsc/test/temba-options.test.js.map +1 -1
- package/out-tsc/test/temba-select.test.js +17 -17
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/out-tsc/test/temba-sortable-list.test.js +1 -1
- package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
- package/out-tsc/test/temba-textinput.test.js +2 -2
- package/out-tsc/test/temba-textinput.test.js.map +1 -1
- package/out-tsc/test/temba-tip.test.js +4 -4
- package/out-tsc/test/temba-tip.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +8 -8
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +6 -15
- package/src/RapidElement.ts +3 -3
- package/src/ResizeElement.ts +2 -2
- package/src/aliaseditor/AliasEditor.ts +1 -2
- package/src/button/Button.ts +1 -1
- package/src/charcount/helpers.ts +1 -1
- package/src/colorpicker/ColorPicker.ts +4 -4
- package/src/completion/Completion.ts +2 -2
- package/src/completion/ExcellentParser.ts +1 -1
- package/src/completion/helpers.ts +9 -9
- package/src/compose/Compose.ts +18 -16
- package/src/contacts/ContactBadges.ts +2 -2
- package/src/contacts/ContactChat.ts +4 -4
- package/src/contacts/ContactDetails.ts +4 -4
- package/src/contacts/ContactFieldEditor.ts +4 -4
- package/src/contacts/ContactFields.ts +2 -2
- package/src/contacts/ContactHistory.ts +25 -22
- package/src/contacts/ContactPending.ts +4 -4
- package/src/contacts/ContactTickets.ts +9 -9
- package/src/contacts/events.ts +3 -3
- package/src/contacts/helpers.ts +2 -2
- package/src/contactsearch/ContactSearch.ts +9 -9
- package/src/date/TembaDate.ts +1 -1
- package/src/datepicker/DatePicker.ts +1 -1
- package/src/dialog/Dialog.ts +6 -6
- package/src/dialog/Modax.ts +8 -8
- package/src/dropdown/Dropdown.ts +1 -2
- package/src/emojis.json +1882 -1
- package/src/fields/FieldManager.ts +6 -7
- package/src/imagepicker/ImagePicker.ts +4 -4
- package/src/interfaces.ts +4 -4
- package/src/label/Label.ts +1 -1
- package/src/leafletmap/LeafletMap.ts +6 -6
- package/src/leafletmap/helpers.ts +2 -2
- package/src/lightbox/Lightbox.ts +2 -2
- package/src/list/ContentMenu.ts +9 -9
- package/src/list/NotificationList.ts +7 -3
- package/src/list/RunList.ts +1 -1
- package/src/list/SortableList.ts +6 -6
- package/src/list/TembaList.ts +5 -5
- package/src/list/TembaMenu.ts +23 -23
- package/src/loading/Loading.ts +1 -1
- package/src/locales/es.ts +1 -1
- package/src/locales/fr.ts +1 -1
- package/src/locales/pt.ts +1 -1
- package/src/omnibox/Omnibox.ts +2 -2
- package/src/options/Options.ts +9 -9
- package/src/remote/Remote.ts +1 -1
- package/src/select/Select.ts +19 -19
- package/src/sms/gsmsplitter.ts +8 -8
- package/src/sms/gsmvalidator.ts +1 -1
- package/src/sms/index.ts +2 -2
- package/src/sms/unicodesplitter.ts +8 -8
- package/src/store/Store.ts +10 -10
- package/src/store/StoreElement.ts +2 -2
- package/src/tabpane/TabPane.ts +4 -4
- package/src/templates/TemplateEditor.ts +9 -9
- package/src/textinput/TextInput.ts +2 -2
- package/src/thumbnail/Thumbnail.ts +5 -5
- package/src/tip/Tip.ts +3 -3
- package/src/utils/index.ts +24 -24
- package/src/vectoricon/VectorIcon.ts +2 -2
- package/src/vectoricon/index.ts +3 -1
- package/src/webchat/WebChat.ts +272 -87
- package/src/webchat/assets.ts +2 -0
- package/src/webchat/index.ts +1 -1
- package/svg.js +28 -29
- package/test/temba-alert.test.ts +1 -1
- package/test/temba-checkbox.test.ts +1 -1
- package/test/temba-color-picker.test.ts +4 -4
- package/test/temba-compose.test.ts +50 -55
- package/test/temba-contact-badges.test.ts +2 -2
- package/test/temba-contact-chat.test.ts +26 -46
- package/test/temba-contact-details.test.ts +2 -8
- package/test/temba-contact-fields.test.ts +4 -11
- package/test/temba-contact-history.test.ts +3 -3
- package/test/temba-contact-search.test.ts +7 -13
- package/test/temba-contact-tickets.test.ts +3 -3
- package/test/temba-content-menu.test.ts +7 -7
- package/test/temba-date.test.ts +3 -3
- package/test/temba-datepicker.test.ts +1 -1
- package/test/temba-field-manager.test.ts +1 -4
- package/test/temba-label.test.ts +6 -6
- package/test/temba-lightbox.test.ts +2 -2
- package/test/temba-list.test.ts +6 -6
- package/test/temba-menu.test.ts +4 -5
- package/test/temba-modax.test.ts +3 -3
- package/test/temba-options.test.ts +1 -1
- package/test/temba-select.test.ts +17 -17
- package/test/temba-sortable-list.test.ts +1 -1
- package/test/temba-textinput.test.ts +2 -2
- package/test/temba-tip.test.ts +5 -5
- package/test/utils.test.ts +8 -9
|
@@ -2,8 +2,7 @@ import { useFakeTimers } from 'sinon';
|
|
|
2
2
|
import { Button } from '../src/button/Button';
|
|
3
3
|
import { Compose } from '../src/compose/Compose';
|
|
4
4
|
import { ContactChat } from '../src/contacts/ContactChat';
|
|
5
|
-
import { Attachment
|
|
6
|
-
import { TicketList } from '../src/list/TicketList';
|
|
5
|
+
import { Attachment } from '../src/interfaces';
|
|
7
6
|
import {
|
|
8
7
|
assertScreenshot,
|
|
9
8
|
clearMockPosts,
|
|
@@ -12,13 +11,13 @@ import {
|
|
|
12
11
|
loadStore,
|
|
13
12
|
mockGET,
|
|
14
13
|
mockNow,
|
|
15
|
-
mockPOST
|
|
14
|
+
mockPOST
|
|
16
15
|
} from '../test/utils.test';
|
|
17
16
|
import {
|
|
18
17
|
getInvalidText,
|
|
19
18
|
getValidAttachments,
|
|
20
19
|
getValidText,
|
|
21
|
-
updateComponent
|
|
20
|
+
updateComponent
|
|
22
21
|
} from './temba-compose.test';
|
|
23
22
|
|
|
24
23
|
let clock: any;
|
|
@@ -42,27 +41,8 @@ const getContactChat = async (attrs: any = {}) => {
|
|
|
42
41
|
return chat;
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
const list_TAG = 'temba-list';
|
|
46
|
-
const getTicketList = async (attrs: any = {}) => {
|
|
47
|
-
const list = (await getComponent(list_TAG, attrs)) as TicketList;
|
|
48
|
-
|
|
49
|
-
if (!list.endpoint) {
|
|
50
|
-
return list;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return new Promise<TicketList>(resolve => {
|
|
54
|
-
list.addEventListener(
|
|
55
|
-
CustomEventType.FetchComplete,
|
|
56
|
-
async () => {
|
|
57
|
-
resolve(list);
|
|
58
|
-
},
|
|
59
|
-
{ once: true }
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
44
|
const getResponseSuccessFiles = (attachments: Attachment[]) => {
|
|
65
|
-
const response_attachments = attachments.map(attachment => {
|
|
45
|
+
const response_attachments = attachments.map((attachment) => {
|
|
66
46
|
return { content_type: attachment.content_type, url: attachment.url };
|
|
67
47
|
});
|
|
68
48
|
return response_attachments;
|
|
@@ -89,7 +69,7 @@ describe('temba-contact-chat - contact tests', () => {
|
|
|
89
69
|
// we are a StoreElement, so load a store first
|
|
90
70
|
await loadStore();
|
|
91
71
|
const chat: ContactChat = await getContactChat({
|
|
92
|
-
contact: 'contact-dave-active'
|
|
72
|
+
contact: 'contact-dave-active'
|
|
93
73
|
});
|
|
94
74
|
|
|
95
75
|
await assertScreenshot('contacts/contact-active-default', getClip(chat));
|
|
@@ -99,7 +79,7 @@ describe('temba-contact-chat - contact tests', () => {
|
|
|
99
79
|
// we are a StoreElement, so load a store first
|
|
100
80
|
await loadStore();
|
|
101
81
|
const chat: ContactChat = await getContactChat({
|
|
102
|
-
contact: 'contact-dave-active'
|
|
82
|
+
contact: 'contact-dave-active'
|
|
103
83
|
});
|
|
104
84
|
|
|
105
85
|
await assertScreenshot(
|
|
@@ -112,7 +92,7 @@ describe('temba-contact-chat - contact tests', () => {
|
|
|
112
92
|
// we are a StoreElement, so load a store first
|
|
113
93
|
await loadStore();
|
|
114
94
|
const chat: ContactChat = await getContactChat({
|
|
115
|
-
contact: 'contact-barack-archived'
|
|
95
|
+
contact: 'contact-barack-archived'
|
|
116
96
|
});
|
|
117
97
|
|
|
118
98
|
await assertScreenshot(
|
|
@@ -125,7 +105,7 @@ describe('temba-contact-chat - contact tests', () => {
|
|
|
125
105
|
// we are a StoreElement, so load a store first
|
|
126
106
|
await loadStore();
|
|
127
107
|
const chat: ContactChat = await getContactChat({
|
|
128
|
-
contact: 'contact-michelle-blocked'
|
|
108
|
+
contact: 'contact-michelle-blocked'
|
|
129
109
|
});
|
|
130
110
|
|
|
131
111
|
await assertScreenshot(
|
|
@@ -138,7 +118,7 @@ describe('temba-contact-chat - contact tests', () => {
|
|
|
138
118
|
// we are a StoreElement, so load a store first
|
|
139
119
|
await loadStore();
|
|
140
120
|
const chat: ContactChat = await getContactChat({
|
|
141
|
-
contact: 'contact-tim-stopped'
|
|
121
|
+
contact: 'contact-tim-stopped'
|
|
142
122
|
});
|
|
143
123
|
|
|
144
124
|
await assertScreenshot(
|
|
@@ -166,7 +146,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text no attac
|
|
|
166
146
|
// we are a StoreElement, so load a store first
|
|
167
147
|
await loadStore();
|
|
168
148
|
const chat: ContactChat = await getContactChat({
|
|
169
|
-
contact: 'contact-dave-active'
|
|
149
|
+
contact: 'contact-dave-active'
|
|
170
150
|
});
|
|
171
151
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
172
152
|
const text = getValidText();
|
|
@@ -175,7 +155,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text no attac
|
|
|
175
155
|
const response_body = {
|
|
176
156
|
contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },
|
|
177
157
|
text: text,
|
|
178
|
-
attachments: []
|
|
158
|
+
attachments: []
|
|
179
159
|
};
|
|
180
160
|
mockPOST(/api\/v2\/messages\.json/, response_body);
|
|
181
161
|
|
|
@@ -194,14 +174,14 @@ describe('temba-contact-chat - contact tests - handle send tests - text no attac
|
|
|
194
174
|
// we are a StoreElement, so load a store first
|
|
195
175
|
await loadStore();
|
|
196
176
|
const chat: ContactChat = await getContactChat({
|
|
197
|
-
contact: 'contact-dave-active'
|
|
177
|
+
contact: 'contact-dave-active'
|
|
198
178
|
});
|
|
199
179
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
200
180
|
// set the chatbox to a string that is 640+ chars
|
|
201
181
|
await updateComponent(compose, getInvalidText());
|
|
202
182
|
|
|
203
183
|
const response_body = {
|
|
204
|
-
text: [responseTextError]
|
|
184
|
+
text: [responseTextError]
|
|
205
185
|
};
|
|
206
186
|
const response_headers = {};
|
|
207
187
|
const response_status = '400';
|
|
@@ -242,7 +222,7 @@ describe('temba-contact-chat - contact tests - handle send tests - attachments n
|
|
|
242
222
|
// we are a StoreElement, so load a store first
|
|
243
223
|
await loadStore();
|
|
244
224
|
const chat: ContactChat = await getContactChat({
|
|
245
|
-
contact: 'contact-dave-active'
|
|
225
|
+
contact: 'contact-dave-active'
|
|
246
226
|
});
|
|
247
227
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
248
228
|
const attachments = getValidAttachments();
|
|
@@ -251,7 +231,7 @@ describe('temba-contact-chat - contact tests - handle send tests - attachments n
|
|
|
251
231
|
const response_body = {
|
|
252
232
|
contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },
|
|
253
233
|
text: '',
|
|
254
|
-
attachments: response_attachments
|
|
234
|
+
attachments: response_attachments
|
|
255
235
|
};
|
|
256
236
|
const response_headers = {};
|
|
257
237
|
const response_status = '200';
|
|
@@ -276,14 +256,14 @@ describe('temba-contact-chat - contact tests - handle send tests - attachments n
|
|
|
276
256
|
// we are a StoreElement, so load a store first
|
|
277
257
|
await loadStore();
|
|
278
258
|
const chat: ContactChat = await getContactChat({
|
|
279
|
-
contact: 'contact-dave-active'
|
|
259
|
+
contact: 'contact-dave-active'
|
|
280
260
|
});
|
|
281
261
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
282
262
|
// set the attachments to a list that is 10+ items
|
|
283
263
|
await updateComponent(compose, null, getValidAttachments(11));
|
|
284
264
|
|
|
285
265
|
const response_body = {
|
|
286
|
-
attachments: [responseAttachmentError]
|
|
266
|
+
attachments: [responseAttachmentError]
|
|
287
267
|
};
|
|
288
268
|
const response_headers = {};
|
|
289
269
|
const response_status = '400';
|
|
@@ -324,7 +304,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
324
304
|
// we are a StoreElement, so load a store first
|
|
325
305
|
await loadStore();
|
|
326
306
|
const chat: ContactChat = await getContactChat({
|
|
327
|
-
contact: 'contact-dave-active'
|
|
307
|
+
contact: 'contact-dave-active'
|
|
328
308
|
});
|
|
329
309
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
330
310
|
const text = getValidText();
|
|
@@ -334,7 +314,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
334
314
|
const response_body = {
|
|
335
315
|
contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },
|
|
336
316
|
text: text,
|
|
337
|
-
attachments: response_attachments
|
|
317
|
+
attachments: response_attachments
|
|
338
318
|
};
|
|
339
319
|
mockPOST(/api\/v2\/messages\.json/, response_body);
|
|
340
320
|
|
|
@@ -353,14 +333,14 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
353
333
|
// we are a StoreElement, so load a store first
|
|
354
334
|
await loadStore();
|
|
355
335
|
const chat: ContactChat = await getContactChat({
|
|
356
|
-
contact: 'contact-dave-active'
|
|
336
|
+
contact: 'contact-dave-active'
|
|
357
337
|
});
|
|
358
338
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
359
339
|
// set the chatbox to a string that is 640+ chars
|
|
360
340
|
await updateComponent(compose, getInvalidText(), getValidAttachments());
|
|
361
341
|
|
|
362
342
|
const response_body = {
|
|
363
|
-
text: [responseTextError]
|
|
343
|
+
text: [responseTextError]
|
|
364
344
|
};
|
|
365
345
|
const response_headers = {};
|
|
366
346
|
const response_status = '400';
|
|
@@ -386,14 +366,14 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
386
366
|
// we are a StoreElement, so load a store first
|
|
387
367
|
await loadStore();
|
|
388
368
|
const chat: ContactChat = await getContactChat({
|
|
389
|
-
contact: 'contact-dave-active'
|
|
369
|
+
contact: 'contact-dave-active'
|
|
390
370
|
});
|
|
391
371
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
392
372
|
// set the attachments to a list that is 10+ items
|
|
393
373
|
await updateComponent(compose, getValidText(), getValidAttachments(11));
|
|
394
374
|
|
|
395
375
|
const response_body = {
|
|
396
|
-
attachments: [responseAttachmentError]
|
|
376
|
+
attachments: [responseAttachmentError]
|
|
397
377
|
};
|
|
398
378
|
const response_headers = {};
|
|
399
379
|
const response_status = '400';
|
|
@@ -419,7 +399,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
419
399
|
// we are a StoreElement, so load a store first
|
|
420
400
|
await loadStore();
|
|
421
401
|
const chat: ContactChat = await getContactChat({
|
|
422
|
-
contact: 'contact-dave-active'
|
|
402
|
+
contact: 'contact-dave-active'
|
|
423
403
|
});
|
|
424
404
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
425
405
|
// set the chatbox to a string that is 640+ chars
|
|
@@ -428,7 +408,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
428
408
|
|
|
429
409
|
const response_body = {
|
|
430
410
|
text: [responseTextError],
|
|
431
|
-
attachments: [responseAttachmentError]
|
|
411
|
+
attachments: [responseAttachmentError]
|
|
432
412
|
};
|
|
433
413
|
const response_headers = {};
|
|
434
414
|
const response_status = '400';
|
|
@@ -454,7 +434,7 @@ describe('temba-contact-chat - contact tests - handle send tests - text and atta
|
|
|
454
434
|
// we are a StoreElement, so load a store first
|
|
455
435
|
await loadStore();
|
|
456
436
|
const chat: ContactChat = await getContactChat({
|
|
457
|
-
contact: 'contact-dave-active'
|
|
437
|
+
contact: 'contact-dave-active'
|
|
458
438
|
});
|
|
459
439
|
const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;
|
|
460
440
|
await updateComponent(compose, getValidText(), getValidAttachments());
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { assert, waitUntil } from '@open-wc/testing';
|
|
2
2
|
import { ContactDetails } from '../src/contacts/ContactDetails';
|
|
3
|
-
import {
|
|
4
|
-
assertScreenshot,
|
|
5
|
-
getClip,
|
|
6
|
-
getComponent,
|
|
7
|
-
loadStore,
|
|
8
|
-
mockGET,
|
|
9
|
-
} from './utils.test';
|
|
3
|
+
import { getComponent, loadStore, mockGET } from './utils.test';
|
|
10
4
|
|
|
11
5
|
const TAG = 'temba-contact-details';
|
|
12
6
|
const getContactDetails = async (attrs: any = {}) => {
|
|
@@ -32,7 +26,7 @@ describe('temba-contact-tickets', () => {
|
|
|
32
26
|
it('renders default', async () => {
|
|
33
27
|
await loadStore();
|
|
34
28
|
const contactDetails: ContactDetails = await getContactDetails({
|
|
35
|
-
contact: '24d64810-3315-4ff5-be85-48e3fe055bf9'
|
|
29
|
+
contact: '24d64810-3315-4ff5-be85-48e3fe055bf9'
|
|
36
30
|
});
|
|
37
31
|
|
|
38
32
|
assert.instanceOf(contactDetails, ContactDetails);
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { assert, expect } from '@open-wc/testing';
|
|
2
2
|
import { ContactFields } from '../src/contacts/ContactFields';
|
|
3
|
-
import {
|
|
4
|
-
assertScreenshot,
|
|
5
|
-
delay,
|
|
6
|
-
getClip,
|
|
7
|
-
getComponent,
|
|
8
|
-
loadStore,
|
|
9
|
-
mockPOST,
|
|
10
|
-
} from './utils.test';
|
|
3
|
+
import { delay, getComponent, loadStore, mockPOST } from './utils.test';
|
|
11
4
|
|
|
12
5
|
const TAG = 'temba-contact-fields';
|
|
13
6
|
const getFields = async (attrs: any = {}) => {
|
|
@@ -26,7 +19,7 @@ describe(TAG, () => {
|
|
|
26
19
|
await loadStore();
|
|
27
20
|
|
|
28
21
|
const fields: ContactFields = await getFields({
|
|
29
|
-
contact: 'contact-dave-active'
|
|
22
|
+
contact: 'contact-dave-active'
|
|
30
23
|
});
|
|
31
24
|
assert.instanceOf(fields, ContactFields);
|
|
32
25
|
// await assertScreenshot('contacts/fields', getClip(fields));
|
|
@@ -35,11 +28,11 @@ describe(TAG, () => {
|
|
|
35
28
|
it('handles updated contacts properly', async () => {
|
|
36
29
|
await loadStore();
|
|
37
30
|
const fields: ContactFields = await getFields({
|
|
38
|
-
contact: 'contact-dave-active'
|
|
31
|
+
contact: 'contact-dave-active'
|
|
39
32
|
});
|
|
40
33
|
|
|
41
34
|
const data = fields.data;
|
|
42
|
-
data.groups.forEach(group => {
|
|
35
|
+
data.groups.forEach((group) => {
|
|
43
36
|
delete group['is_dynamic'];
|
|
44
37
|
});
|
|
45
38
|
mockPOST(/api\/v2\/contacts\.json\?uuid=contact-dave-active/, data);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getHTML,
|
|
8
8
|
loadStore,
|
|
9
9
|
mockGET,
|
|
10
|
-
mockNow
|
|
10
|
+
mockNow
|
|
11
11
|
} from '../test/utils.test';
|
|
12
12
|
import './utils.test';
|
|
13
13
|
|
|
@@ -69,7 +69,7 @@ describe('temba-contact-history', () => {
|
|
|
69
69
|
it('renders history', async () => {
|
|
70
70
|
const history = await createHistory(
|
|
71
71
|
getHistoryHTML({
|
|
72
|
-
uuid: 'contact-dave-active'
|
|
72
|
+
uuid: 'contact-dave-active'
|
|
73
73
|
})
|
|
74
74
|
);
|
|
75
75
|
|
|
@@ -89,7 +89,7 @@ describe('temba-contact-history', () => {
|
|
|
89
89
|
it('expands event groups', async () => {
|
|
90
90
|
const history = await createHistory(
|
|
91
91
|
getHistoryHTML({
|
|
92
|
-
uuid: 'contact-dave-active'
|
|
92
|
+
uuid: 'contact-dave-active'
|
|
93
93
|
})
|
|
94
94
|
);
|
|
95
95
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { fixture, assert, expect } from '@open-wc/testing';
|
|
2
2
|
import { ContactSearch } from '../src/contactsearch/ContactSearch';
|
|
3
|
-
import {
|
|
4
|
-
assertScreenshot,
|
|
5
|
-
delay,
|
|
6
|
-
getClip,
|
|
7
|
-
getHTML,
|
|
8
|
-
mockPOST,
|
|
9
|
-
} from './utils.test';
|
|
3
|
+
import { assertScreenshot, getClip, getHTML, mockPOST } from './utils.test';
|
|
10
4
|
import { useFakeTimers } from 'sinon';
|
|
11
5
|
import { CustomEventType } from '../src/interfaces';
|
|
12
6
|
import { Omnibox } from '../src/omnibox/Omnibox';
|
|
@@ -14,7 +8,7 @@ import { Omnibox } from '../src/omnibox/Omnibox';
|
|
|
14
8
|
let clock: any;
|
|
15
9
|
|
|
16
10
|
function waitForSearch(search: ContactSearch) {
|
|
17
|
-
return new Promise<ContactSearch>(resolve => {
|
|
11
|
+
return new Promise<ContactSearch>((resolve) => {
|
|
18
12
|
search.addEventListener(
|
|
19
13
|
CustomEventType.ContentChanged,
|
|
20
14
|
async () => {
|
|
@@ -47,7 +41,7 @@ describe('temba-contact-search', () => {
|
|
|
47
41
|
const search: ContactSearch = await fixture(
|
|
48
42
|
getHTML('temba-contact-search', {
|
|
49
43
|
advanced: true,
|
|
50
|
-
endpoint
|
|
44
|
+
endpoint
|
|
51
45
|
})
|
|
52
46
|
);
|
|
53
47
|
|
|
@@ -66,7 +60,7 @@ describe('temba-contact-search', () => {
|
|
|
66
60
|
await waitForSearch(search);
|
|
67
61
|
|
|
68
62
|
expect(search.errors).to.deep.equal([
|
|
69
|
-
"'Missing' is not a valid group name"
|
|
63
|
+
"'Missing' is not a valid group name"
|
|
70
64
|
]);
|
|
71
65
|
|
|
72
66
|
await search.updateComplete;
|
|
@@ -77,7 +71,7 @@ describe('temba-contact-search', () => {
|
|
|
77
71
|
const endpoint = '/contact-search-manual';
|
|
78
72
|
const search: ContactSearch = await fixture(
|
|
79
73
|
getHTML('temba-contact-search', {
|
|
80
|
-
endpoint
|
|
74
|
+
endpoint
|
|
81
75
|
})
|
|
82
76
|
);
|
|
83
77
|
|
|
@@ -95,9 +89,9 @@ describe('temba-contact-search', () => {
|
|
|
95
89
|
total: 1937,
|
|
96
90
|
warnings: [
|
|
97
91
|
'This flow does not specify a Facebook topic. You may still start this flow but Facebook contacts who have not sent an incoming message in the last 24 hours may not receive it.',
|
|
98
|
-
'This flow does not use message templates. You may still start this flow but WhatsApp contacts who have not sent an incoming message in the last 24 hours may not receive it.'
|
|
92
|
+
'This flow does not use message templates. You may still start this flow but WhatsApp contacts who have not sent an incoming message in the last 24 hours may not receive it.'
|
|
99
93
|
],
|
|
100
|
-
blockers: []
|
|
94
|
+
blockers: []
|
|
101
95
|
},
|
|
102
96
|
{ 'Temba-Success': 'hide' }
|
|
103
97
|
);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getComponent,
|
|
7
7
|
loadStore,
|
|
8
8
|
mockGET,
|
|
9
|
-
mockNow
|
|
9
|
+
mockNow
|
|
10
10
|
} from './utils.test';
|
|
11
11
|
|
|
12
12
|
const TAG = 'temba-contact-tickets';
|
|
@@ -35,7 +35,7 @@ describe('temba-contact-tickets', () => {
|
|
|
35
35
|
it('renders default', async () => {
|
|
36
36
|
const tickets: ContactTickets = await getContactTickets({
|
|
37
37
|
contact: '24d64810-3315-4ff5-be85-48e3fe055bf9',
|
|
38
|
-
agent: 'admin1@nyaruka.com'
|
|
38
|
+
agent: 'admin1@nyaruka.com'
|
|
39
39
|
});
|
|
40
40
|
assert.instanceOf(tickets, ContactTickets);
|
|
41
41
|
await assertScreenshot('contacts/tickets', getClip(tickets));
|
|
@@ -44,7 +44,7 @@ describe('temba-contact-tickets', () => {
|
|
|
44
44
|
it('shows assignment picker', async () => {
|
|
45
45
|
const tickets: ContactTickets = await getContactTickets({
|
|
46
46
|
contact: '24d64810-3315-4ff5-be85-48e3fe055bf9',
|
|
47
|
-
agent: 'admin1@nyaruka.com'
|
|
47
|
+
agent: 'admin1@nyaruka.com'
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// click on the avatar element
|
|
@@ -20,7 +20,7 @@ const getContentMenu = async (attrs: any = {}, width = 0) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// if we have an endpoint, wait for a loaded event before returning
|
|
23
|
-
return new Promise<ContentMenu>(resolve => {
|
|
23
|
+
return new Promise<ContentMenu>((resolve) => {
|
|
24
24
|
contentMenu.addEventListener(
|
|
25
25
|
CustomEventType.Loaded,
|
|
26
26
|
async () => {
|
|
@@ -40,7 +40,7 @@ describe('temba-content-menu', () => {
|
|
|
40
40
|
|
|
41
41
|
it('with 1+ items and 1+ buttons', async () => {
|
|
42
42
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
43
|
-
endpoint: '/test-assets/list/content-menu-contact-read.json'
|
|
43
|
+
endpoint: '/test-assets/list/content-menu-contact-read.json'
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
expect(contentMenu.items.length).equals(5);
|
|
@@ -53,7 +53,7 @@ describe('temba-content-menu', () => {
|
|
|
53
53
|
|
|
54
54
|
it('with 1+ items and 0 buttons', async () => {
|
|
55
55
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
56
|
-
endpoint: '/test-assets/list/content-menu-archived-contacts.json'
|
|
56
|
+
endpoint: '/test-assets/list/content-menu-archived-contacts.json'
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
expect(contentMenu.items.length).equals(1);
|
|
@@ -66,7 +66,7 @@ describe('temba-content-menu', () => {
|
|
|
66
66
|
|
|
67
67
|
it('with 0 items and 1+ buttons', async () => {
|
|
68
68
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
69
|
-
endpoint: '/test-assets/list/content-menu-new-campaign.json'
|
|
69
|
+
endpoint: '/test-assets/list/content-menu-new-campaign.json'
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
expect(contentMenu.items.length).equals(0);
|
|
@@ -79,7 +79,7 @@ describe('temba-content-menu', () => {
|
|
|
79
79
|
|
|
80
80
|
it('bad endpoint', async () => {
|
|
81
81
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
82
|
-
endpoint: '/test-assets/list/content-menu-bad-endpoint.json'
|
|
82
|
+
endpoint: '/test-assets/list/content-menu-bad-endpoint.json'
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
expect(contentMenu.items.length).equals(0);
|
|
@@ -89,7 +89,7 @@ describe('temba-content-menu', () => {
|
|
|
89
89
|
it('is spa page', async () => {
|
|
90
90
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
91
91
|
endpoint: '/test-assets/list/content-menu-contact-read.json',
|
|
92
|
-
legacy: 0
|
|
92
|
+
legacy: 0
|
|
93
93
|
});
|
|
94
94
|
expect(contentMenu.legacy).equals(0);
|
|
95
95
|
});
|
|
@@ -97,7 +97,7 @@ describe('temba-content-menu', () => {
|
|
|
97
97
|
it('is legacy page', async () => {
|
|
98
98
|
const contentMenu: ContentMenu = await getContentMenu({
|
|
99
99
|
endpoint: '/test-assets/list/content-menu-contact-read.json',
|
|
100
|
-
legacy: 1
|
|
100
|
+
legacy: 1
|
|
101
101
|
});
|
|
102
102
|
expect(contentMenu.legacy).equals(1);
|
|
103
103
|
});
|
package/test/temba-date.test.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getClip,
|
|
6
6
|
getComponent,
|
|
7
7
|
loadStore,
|
|
8
|
-
mockNow
|
|
8
|
+
mockNow
|
|
9
9
|
} from './utils.test';
|
|
10
10
|
|
|
11
11
|
const TAG = 'temba-date';
|
|
@@ -35,7 +35,7 @@ describe('temba-date', () => {
|
|
|
35
35
|
it('renders duration', async () => {
|
|
36
36
|
const date = await getDate({
|
|
37
37
|
value: '1978-11-18T02:22:00.000000-07:00',
|
|
38
|
-
display: 'duration'
|
|
38
|
+
display: 'duration'
|
|
39
39
|
});
|
|
40
40
|
const dateString = (
|
|
41
41
|
date.shadowRoot.querySelector('.date') as HTMLSpanElement
|
|
@@ -48,7 +48,7 @@ describe('temba-date', () => {
|
|
|
48
48
|
it('renders datetime', async () => {
|
|
49
49
|
const date = await getDate({
|
|
50
50
|
value: '1978-11-18T02:22:00.000000-07:00',
|
|
51
|
-
display: 'datetime'
|
|
51
|
+
display: 'datetime'
|
|
52
52
|
});
|
|
53
53
|
const dateString = (
|
|
54
54
|
date.shadowRoot.querySelector('.date') as HTMLSpanElement
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
2
|
-
import { html } from 'lit';
|
|
3
2
|
import { FieldManager } from '../src/fields/FieldManager';
|
|
4
3
|
import { TextInput } from '../src/textinput/TextInput';
|
|
5
4
|
import {
|
|
6
5
|
assertScreenshot,
|
|
7
6
|
getAttributes,
|
|
8
7
|
getClip,
|
|
9
|
-
loadStore
|
|
8
|
+
loadStore
|
|
10
9
|
} from './utils.test';
|
|
11
10
|
|
|
12
|
-
const BORING_LIST = html`<temba-field-manager />`;
|
|
13
|
-
|
|
14
11
|
export const getEle = async (attrs: any = {}) => {
|
|
15
12
|
const fm = `<temba-field-manager
|
|
16
13
|
${getAttributes(attrs)}
|
package/test/temba-label.test.ts
CHANGED
|
@@ -22,7 +22,7 @@ describe('temba-label', () => {
|
|
|
22
22
|
it('renders shadow', async () => {
|
|
23
23
|
const label: Label = await getLabel('Shadow', {
|
|
24
24
|
icon: 'check',
|
|
25
|
-
shadow: true
|
|
25
|
+
shadow: true
|
|
26
26
|
});
|
|
27
27
|
await assertScreenshot('label/shadow', getClip(label));
|
|
28
28
|
});
|
|
@@ -30,7 +30,7 @@ describe('temba-label', () => {
|
|
|
30
30
|
it('renders primary', async () => {
|
|
31
31
|
const label: Label = await getLabel('Primary', {
|
|
32
32
|
icon: 'check',
|
|
33
|
-
primary: true
|
|
33
|
+
primary: true
|
|
34
34
|
});
|
|
35
35
|
await assertScreenshot('label/primary', getClip(label));
|
|
36
36
|
});
|
|
@@ -38,7 +38,7 @@ describe('temba-label', () => {
|
|
|
38
38
|
it('renders secondary', async () => {
|
|
39
39
|
const label: Label = await getLabel('Secondary', {
|
|
40
40
|
icon: 'check',
|
|
41
|
-
secondary: true
|
|
41
|
+
secondary: true
|
|
42
42
|
});
|
|
43
43
|
await assertScreenshot('label/secondary', getClip(label));
|
|
44
44
|
});
|
|
@@ -46,7 +46,7 @@ describe('temba-label', () => {
|
|
|
46
46
|
it('renders tertiary', async () => {
|
|
47
47
|
const label: Label = await getLabel('Tertiary', {
|
|
48
48
|
icon: 'check',
|
|
49
|
-
tertiary: true
|
|
49
|
+
tertiary: true
|
|
50
50
|
});
|
|
51
51
|
await assertScreenshot('label/tertiary', getClip(label));
|
|
52
52
|
});
|
|
@@ -59,7 +59,7 @@ describe('temba-label', () => {
|
|
|
59
59
|
it('renders danger', async () => {
|
|
60
60
|
const label: Label = await getLabel('Danger', {
|
|
61
61
|
icon: 'check',
|
|
62
|
-
danger: true
|
|
62
|
+
danger: true
|
|
63
63
|
});
|
|
64
64
|
await assertScreenshot('label/danger', getClip(label));
|
|
65
65
|
});
|
|
@@ -68,7 +68,7 @@ describe('temba-label', () => {
|
|
|
68
68
|
const label: Label = await getLabel('Custom Orange', {
|
|
69
69
|
icon: 'check',
|
|
70
70
|
backgroundColor: 'rgb(240, 176, 29)',
|
|
71
|
-
textColor: '#ffff'
|
|
71
|
+
textColor: '#ffff'
|
|
72
72
|
});
|
|
73
73
|
await assertScreenshot('label/custom', getClip(label));
|
|
74
74
|
});
|
|
@@ -19,7 +19,7 @@ describe('temba-lightbox', () => {
|
|
|
19
19
|
x: 28,
|
|
20
20
|
y: 28,
|
|
21
21
|
width: 1024,
|
|
22
|
-
height: 768
|
|
22
|
+
height: 768
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
assert.instanceOf(lightbox, Lightbox);
|
|
@@ -29,7 +29,7 @@ describe('temba-lightbox', () => {
|
|
|
29
29
|
x: 28,
|
|
30
30
|
y: 28,
|
|
31
31
|
width: 1024,
|
|
32
|
-
height: 768
|
|
32
|
+
height: 768
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
});
|
package/test/temba-list.test.ts
CHANGED
|
@@ -15,7 +15,7 @@ const getList = async (attrs: any = {}) => {
|
|
|
15
15
|
return list;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return new Promise<TembaList>(resolve => {
|
|
18
|
+
return new Promise<TembaList>((resolve) => {
|
|
19
19
|
list.addEventListener(
|
|
20
20
|
CustomEventType.FetchComplete,
|
|
21
21
|
async () => {
|
|
@@ -48,7 +48,7 @@ describe('temba-list', () => {
|
|
|
48
48
|
|
|
49
49
|
it('renders with endpoint', async () => {
|
|
50
50
|
const list: TembaList = await getList({
|
|
51
|
-
endpoint: '/test-assets/list/temba-list.json'
|
|
51
|
+
endpoint: '/test-assets/list/temba-list.json'
|
|
52
52
|
});
|
|
53
53
|
expect(list.items.length).to.equal(4);
|
|
54
54
|
await assertScreenshot('list/items', getClip(list));
|
|
@@ -56,10 +56,10 @@ describe('temba-list', () => {
|
|
|
56
56
|
|
|
57
57
|
it('fires change event on cursor change', async () => {
|
|
58
58
|
const list: TembaList = await getList({
|
|
59
|
-
endpoint: '/test-assets/list/temba-list.json'
|
|
59
|
+
endpoint: '/test-assets/list/temba-list.json'
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
const changeTest = new Promise<void>(resolve => {
|
|
62
|
+
const changeTest = new Promise<void>((resolve) => {
|
|
63
63
|
list.addEventListener('change', () => {
|
|
64
64
|
resolve();
|
|
65
65
|
});
|
|
@@ -73,14 +73,14 @@ describe('temba-list', () => {
|
|
|
73
73
|
|
|
74
74
|
it('fires change when first element changes after fetch', async () => {
|
|
75
75
|
const list: TembaList = await getList({
|
|
76
|
-
endpoint: '/test-assets/list/temba-list.json'
|
|
76
|
+
endpoint: '/test-assets/list/temba-list.json'
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
// spy on change event
|
|
80
80
|
const changeEvent = sinon.spy();
|
|
81
81
|
list.addEventListener('change', changeEvent);
|
|
82
82
|
|
|
83
|
-
const refreshTest = new Promise<void>(resolve => {
|
|
83
|
+
const refreshTest = new Promise<void>((resolve) => {
|
|
84
84
|
list.addEventListener(CustomEventType.FetchComplete, () => {
|
|
85
85
|
resolve();
|
|
86
86
|
});
|