@nyaruka/temba-components 0.141.0 → 0.142.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/CHANGELOG.md +22 -0
- package/dist/static/svg/index.svg +1 -1
- package/dist/temba-components.js +859 -656
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/Icons.js +3 -1
- package/out-tsc/src/Icons.js.map +1 -1
- package/out-tsc/src/display/Button.js +2 -2
- package/out-tsc/src/display/Button.js.map +1 -1
- package/out-tsc/src/display/FloatingTab.js.map +1 -1
- package/out-tsc/src/flow/CanvasMenu.js +24 -1
- package/out-tsc/src/flow/CanvasMenu.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +7 -2
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +665 -67
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +8 -5
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/Plumber.js +40 -28
- package/out-tsc/src/flow/Plumber.js.map +1 -1
- package/out-tsc/src/flow/actions/send_msg.js +2 -1
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/reflow.js +393 -0
- package/out-tsc/src/flow/reflow.js.map +1 -0
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/flow/utils.js +18 -3
- package/out-tsc/src/flow/utils.js.map +1 -1
- package/out-tsc/src/form/Compose.js +5 -0
- package/out-tsc/src/form/Compose.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +1 -3
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js +2 -0
- package/out-tsc/src/layout/Dialog.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +39 -19
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +10 -1
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/version.js +9 -0
- package/out-tsc/src/version.js.map +1 -0
- package/out-tsc/test/temba-canvas-menu.test.js +44 -0
- package/out-tsc/test/temba-canvas-menu.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +12 -0
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-flow-collision.test.js +25 -0
- package/out-tsc/test/temba-flow-collision.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-zoom.test.js +491 -0
- package/out-tsc/test/temba-flow-editor-zoom.test.js.map +1 -0
- package/out-tsc/test/temba-flow-editor.test.js +164 -1
- package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
- package/out-tsc/test/temba-flow-node-drag.test.js +123 -0
- package/out-tsc/test/temba-flow-node-drag.test.js.map +1 -1
- package/out-tsc/test/temba-flow-plumber.test.js +31 -0
- package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
- package/out-tsc/test/temba-flow-reflow.test.js +472 -0
- package/out-tsc/test/temba-flow-reflow.test.js.map +1 -0
- package/out-tsc/test/temba-sortable-list.test.js +93 -0
- package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
- package/package.json +1 -1
- package/rollup.components.mjs +7 -1
- package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/expression-facebook.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/expression-phone.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/facebook-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/instagram-handle.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/line-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/phone-number.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/telegram-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/viber-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/wechat-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/whatsapp.png +0 -0
- package/screenshots/truth/actions/enter_flow/editor/basic-flow.png +0 -0
- package/screenshots/truth/actions/enter_flow/editor/long-flow-name.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/multiline-text.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/text-with-audio-url.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/contacts-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/groups-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/multiline-text.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/actions/set_contact_channel/editor/sms-channel.png +0 -0
- package/screenshots/truth/actions/set_contact_channel/editor/whatsapp-channel.png +0 -0
- package/screenshots/truth/actions/set_contact_field/editor/clear-value.png +0 -0
- package/screenshots/truth/actions/set_contact_field/editor/set-value.png +0 -0
- package/screenshots/truth/actions/set_contact_language/editor/english.png +0 -0
- package/screenshots/truth/actions/set_contact_language/editor/french.png +0 -0
- package/screenshots/truth/actions/set_contact_status/editor/active.png +0 -0
- package/screenshots/truth/actions/set_contact_status/editor/archived.png +0 -0
- package/screenshots/truth/actions/set_contact_status/editor/blocked.png +0 -0
- package/screenshots/truth/actions/set_run_result/editor/expression-value.png +0 -0
- package/screenshots/truth/actions/set_run_result/editor/with-category.png +0 -0
- package/screenshots/truth/actions/start_session/editor/contact-query.png +0 -0
- package/screenshots/truth/actions/start_session/editor/contacts-only.png +0 -0
- package/screenshots/truth/actions/start_session/editor/create-contact.png +0 -0
- package/screenshots/truth/actions/start_session/editor/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/start_session/editor/groups-only.png +0 -0
- package/screenshots/truth/actions/start_session/editor/many-recipients.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/sortable-dragging.png +0 -0
- package/screenshots/truth/modax/simple.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_dial/editor/dial-with-limits.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/digits-with-rules.png +0 -0
- package/screenshots/truth/nodes/wait_for_menu/editor/menu-with-digits.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/src/Icons.ts +3 -1
- package/src/display/Button.ts +2 -2
- package/src/display/FloatingTab.ts +1 -1
- package/src/flow/CanvasMenu.ts +28 -3
- package/src/flow/CanvasNode.ts +7 -2
- package/src/flow/Editor.ts +769 -76
- package/src/flow/NodeEditor.ts +8 -4
- package/src/flow/Plumber.ts +65 -35
- package/src/flow/actions/send_msg.ts +2 -1
- package/src/flow/nodes/wait_for_response.ts +1 -1
- package/src/flow/reflow.ts +534 -0
- package/src/flow/types.ts +1 -0
- package/src/flow/utils.ts +19 -3
- package/src/form/Compose.ts +5 -0
- package/src/form/FieldRenderer.ts +1 -3
- package/src/layout/Dialog.ts +2 -0
- package/src/list/SortableList.ts +40 -19
- package/src/live/ContactChat.ts +10 -1
- package/src/store/flow-definition.d.ts +1 -0
- package/src/version.ts +10 -0
- package/static/svg/index.svg +1 -1
- package/static/svg/work/traced/expand-06.svg +1 -0
- package/static/svg/work/used/expand-06.svg +3 -0
- package/test/temba-canvas-menu.test.ts +55 -0
- package/test/temba-contact-chat.test.ts +17 -0
- package/test/temba-flow-collision.test.ts +31 -0
- package/test/temba-flow-editor-zoom.test.ts +583 -0
- package/test/temba-flow-editor.test.ts +211 -1
- package/test/temba-flow-node-drag.test.ts +171 -0
- package/test/temba-flow-plumber.test.ts +38 -0
- package/test/temba-flow-reflow.test.ts +703 -0
- package/test/temba-sortable-list.test.ts +120 -0
- package/web-dev-server.config.mjs +5 -1
- package/web-test-runner.config.mjs +4 -1
- package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/actions/call_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/actions/call_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/actions/call_llm/render/summarization.png +0 -0
- package/screenshots/truth/actions/call_llm/render/translation-task.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/with-attachments.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/with-attachments.png +0 -0
- package/screenshots/truth/compose/attachments-with-failures.png +0 -0
- package/screenshots/truth/compose/attachments-with-files-and-failures.png +0 -0
- package/screenshots/truth/contacts/tickets-assignment.png +0 -0
- package/screenshots/truth/contacts/tickets.png +0 -0
- package/screenshots/truth/flow/editor-basic.png +0 -0
- package/screenshots/truth/formfield/markdown-errors.png +0 -0
- package/screenshots/truth/formfield/no-errors.png +0 -0
- package/screenshots/truth/formfield/plain-text-errors.png +0 -0
- package/screenshots/truth/formfield/widget-only-markdown-errors.png +0 -0
- package/screenshots/truth/omnibox/selected.png +0 -0
- package/screenshots/truth/select/enabled-multi-selection.png +0 -0
- package/screenshots/truth/select/endpoint-initial-value-updated.png +0 -0
- package/screenshots/truth/select/endpoint-initial-value.png +0 -0
- package/screenshots/truth/select/initial-value.png +0 -0
- package/screenshots/truth/select/multi-reorder-final.png +0 -0
- package/screenshots/truth/select/multi-reorder-initial.png +0 -0
- package/screenshots/truth/select/selected-multi-test.png +0 -0
- package/screenshots/truth/select/value-initial.png +0 -0
- package/screenshots/truth/wait-for-response/rules-editor.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor-unchecked.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor.png +0 -0
- package/screenshots/truth/webchat/connecting-state.png +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.311 2.307 C 2.023 2.517,2.000 2.748,2.000 5.410 C 2.000 8.014,2.029 8.318,2.305 8.623 C 2.711 9.072,3.430 9.063,3.751 8.604 C 3.932 8.346,4.000 7.853,4.000 6.807 L 4.000 5.365 5.803 7.163 C 7.706 9.060,8.137 9.285,8.695 8.667 C 9.243 8.062,9.042 7.688,7.163 5.803 L 5.365 4.000 6.807 4.000 C 8.466 4.000,8.960 3.783,8.960 3.056 C 8.960 2.162,8.670 2.080,5.498 2.080 C 3.266 2.080,2.552 2.131,2.311 2.307 M15.291 2.331 C 15.153 2.470,15.040 2.790,15.040 3.042 C 15.040 3.785,15.524 4.000,17.193 4.000 L 18.635 4.000 16.837 5.803 C 14.940 7.706,14.715 8.137,15.333 8.695 C 15.938 9.243,16.312 9.042,18.197 7.163 L 20.000 5.365 20.000 6.807 C 20.000 7.853,20.068 8.346,20.249 8.604 C 20.570 9.063,21.289 9.072,21.695 8.623 C 21.971 8.318,22.000 8.014,22.000 5.410 C 22.000 2.748,21.977 2.517,21.689 2.307 C 21.211 1.957,15.644 1.979,15.291 2.331 M2.338 15.285 C 1.965 15.658,1.891 16.358,1.948 19.004 C 1.992 21.075,2.042 21.471,2.286 21.715 C 2.538 21.967,2.901 22.000,5.429 22.000 C 8.014 22.000,8.318 21.971,8.623 21.695 C 9.072 21.289,9.063 20.570,8.604 20.249 C 8.346 20.068,7.853 20.000,6.807 20.000 L 5.365 20.000 7.163 18.197 C 9.060 16.294,9.285 15.863,8.667 15.305 C 8.062 14.757,7.688 14.958,5.803 16.837 L 4.000 18.635 4.000 17.193 C 4.000 15.524,3.785 15.040,3.042 15.040 C 2.790 15.040,2.473 15.150,2.338 15.285 M15.305 15.333 C 14.757 15.938,14.958 16.312,16.837 18.197 L 18.635 20.000 17.193 20.000 C 16.147 20.000,15.654 20.068,15.396 20.249 C 14.938 20.570,14.928 21.289,15.376 21.695 C 15.672 21.963,16.023 22.006,18.276 22.051 C 21.112 22.108,21.621 22.001,21.918 21.286 C 22.039 20.992,22.085 19.965,22.051 18.276 C 22.006 16.023,21.963 15.672,21.695 15.376 C 21.289 14.928,20.570 14.938,20.249 15.396 C 20.068 15.654,20.000 16.147,20.000 17.193 L 20.000 18.635 18.197 16.837 C 16.294 14.940,15.863 14.715,15.305 15.333 " stroke="none" fill-rule="evenodd" fill="black"></path></svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M16 8L21 3M21 3H16M21 3V8M8 8L3 3M3 3L3 8M3 3L8 3M8 16L3 21M3 21H8M3 21L3 16M16 16L21 21M21 21V16M21 21H16" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
|
@@ -107,6 +107,61 @@ describe('temba-canvas-menu', () => {
|
|
|
107
107
|
expect(menu.open).to.be.false;
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
it('shows reflow option when showReflow is true', async () => {
|
|
111
|
+
const menu = await createCanvasMenu();
|
|
112
|
+
menu.show(100, 100, { x: 50, y: 50 }, true, true);
|
|
113
|
+
await menu.updateComplete;
|
|
114
|
+
|
|
115
|
+
const menuItems = menu.shadowRoot?.querySelectorAll('.menu-item');
|
|
116
|
+
expect(menuItems?.length).to.equal(4);
|
|
117
|
+
|
|
118
|
+
const titles = Array.from(menuItems || []).map(
|
|
119
|
+
(item) => item.querySelector('.menu-item-title')?.textContent
|
|
120
|
+
);
|
|
121
|
+
expect(titles).to.deep.equal([
|
|
122
|
+
'Add Action',
|
|
123
|
+
'Add Split',
|
|
124
|
+
'Add Sticky Note',
|
|
125
|
+
'Reflow'
|
|
126
|
+
]);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('fires reflow selection event when reflow is clicked', async () => {
|
|
130
|
+
const menu = await createCanvasMenu();
|
|
131
|
+
menu.show(100, 100, { x: 50, y: 50 }, true, true);
|
|
132
|
+
await menu.updateComplete;
|
|
133
|
+
|
|
134
|
+
let selectionDetail = null;
|
|
135
|
+
menu.addEventListener('temba-selection', (event: any) => {
|
|
136
|
+
selectionDetail = event.detail;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const menuItems = menu.shadowRoot?.querySelectorAll('.menu-item');
|
|
140
|
+
const reflowItem = menuItems?.[3] as HTMLElement;
|
|
141
|
+
reflowItem.click();
|
|
142
|
+
await menu.updateComplete;
|
|
143
|
+
|
|
144
|
+
expect(selectionDetail).to.deep.equal({
|
|
145
|
+
action: 'reflow',
|
|
146
|
+
position: { x: 50, y: 50 }
|
|
147
|
+
});
|
|
148
|
+
expect(menu.open).to.be.false;
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('hides reflow option by default', async () => {
|
|
152
|
+
const menu = await createCanvasMenu();
|
|
153
|
+
menu.show(100, 100, { x: 50, y: 50 });
|
|
154
|
+
await menu.updateComplete;
|
|
155
|
+
|
|
156
|
+
const menuItems = menu.shadowRoot?.querySelectorAll('.menu-item');
|
|
157
|
+
expect(menuItems?.length).to.equal(3);
|
|
158
|
+
|
|
159
|
+
const titles = Array.from(menuItems || []).map(
|
|
160
|
+
(item) => item.querySelector('.menu-item-title')?.textContent
|
|
161
|
+
);
|
|
162
|
+
expect(titles).to.not.include('Reflow');
|
|
163
|
+
});
|
|
164
|
+
|
|
110
165
|
it('adjusts position to stay within viewport bounds', async () => {
|
|
111
166
|
const menu = await createCanvasMenu();
|
|
112
167
|
|
|
@@ -116,6 +116,23 @@ describe('temba-contact-chat', () => {
|
|
|
116
116
|
await assertScreenshot('contacts/chat-for-stopped-contact', getClip(chat));
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
+
it('keeps flow footer from blocking scrollbar drag interactions', async () => {
|
|
120
|
+
await loadStore();
|
|
121
|
+
const chat: ContactChat = await getContactChat({
|
|
122
|
+
contact: 'contact-dave-active'
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const flowFooter = chat.shadowRoot.querySelector(
|
|
126
|
+
'.flow-footer'
|
|
127
|
+
) as HTMLElement;
|
|
128
|
+
const inFlow = flowFooter.querySelector('.in-flow') as HTMLElement;
|
|
129
|
+
|
|
130
|
+
expect(flowFooter).to.exist;
|
|
131
|
+
expect(inFlow).to.exist;
|
|
132
|
+
expect(getComputedStyle(flowFooter).pointerEvents).to.equal('none');
|
|
133
|
+
expect(getComputedStyle(inFlow).pointerEvents).to.equal('auto');
|
|
134
|
+
});
|
|
135
|
+
|
|
119
136
|
it('sends text without attachments', async () => {
|
|
120
137
|
// we are a StoreElement, so load a store first
|
|
121
138
|
await loadStore();
|
|
@@ -37,6 +37,37 @@ describe('Collision Detection Utilities', () => {
|
|
|
37
37
|
|
|
38
38
|
document.body.removeChild(mockElement);
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
it('uses layout-space dimensions unaffected by ancestor CSS transform', () => {
|
|
42
|
+
// Simulate zoom: ancestor has transform: scale(0.5)
|
|
43
|
+
const container = document.createElement('div');
|
|
44
|
+
container.style.transform = 'scale(0.5)';
|
|
45
|
+
container.style.transformOrigin = '0 0';
|
|
46
|
+
document.body.appendChild(container);
|
|
47
|
+
|
|
48
|
+
const mockElement = document.createElement('div');
|
|
49
|
+
mockElement.id = 'zoom-test-node';
|
|
50
|
+
mockElement.style.width = '200px';
|
|
51
|
+
mockElement.style.height = '150px';
|
|
52
|
+
container.appendChild(mockElement);
|
|
53
|
+
|
|
54
|
+
const position = { left: 100, top: 200 };
|
|
55
|
+
const bounds = getNodeBounds('zoom-test-node', position, mockElement);
|
|
56
|
+
|
|
57
|
+
// getNodeBounds uses offsetWidth/offsetHeight which are layout-space
|
|
58
|
+
expect(bounds).to.not.be.null;
|
|
59
|
+
expect(bounds!.width).to.equal(200);
|
|
60
|
+
expect(bounds!.height).to.equal(150);
|
|
61
|
+
expect(bounds!.right).to.equal(300); // left + layout width
|
|
62
|
+
expect(bounds!.bottom).to.equal(350); // top + layout height
|
|
63
|
+
|
|
64
|
+
// Verify that getBoundingClientRect WOULD return scaled values
|
|
65
|
+
const rect = mockElement.getBoundingClientRect();
|
|
66
|
+
expect(rect.width).to.equal(100); // 200 * 0.5 scale
|
|
67
|
+
expect(rect.height).to.equal(75); // 150 * 0.5 scale
|
|
68
|
+
|
|
69
|
+
container.remove();
|
|
70
|
+
});
|
|
40
71
|
});
|
|
41
72
|
|
|
42
73
|
describe('nodesOverlap', () => {
|