@nyaruka/temba-components 0.130.0 → 0.130.2
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 +34 -4
- package/DEV_DATA.md +89 -0
- package/demo/data/flows/food-order.json +4 -4
- package/demo/data/flows/sample-flow.json +132 -147
- package/dist/temba-components.js +764 -628
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/Chat.js +5 -3
- package/out-tsc/src/display/Chat.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +83 -78
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +1 -0
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +47 -3
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js +13 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
- package/out-tsc/src/flow/actions/add_input_labels.js +1 -0
- package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +3 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +17 -14
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +12 -12
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +609 -6
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/operators.js +194 -0
- package/out-tsc/src/flow/operators.js.map +1 -0
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +84 -19
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/Checkbox.js +12 -0
- package/out-tsc/src/form/Checkbox.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +13 -3
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/form/TextInput.js +20 -1
- package/out-tsc/src/form/TextInput.js.map +1 -1
- package/out-tsc/src/form/select/Select.js +14 -1
- package/out-tsc/src/form/select/Select.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js +3 -4
- package/out-tsc/src/layout/Dialog.js.map +1 -1
- package/out-tsc/src/list/RunList.js +2 -2
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +114 -34
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/live/ContactDetails.js +7 -0
- package/out-tsc/src/live/ContactDetails.js.map +1 -1
- package/out-tsc/src/live/ContactNameFetch.js +1 -1
- package/out-tsc/src/live/ContactNameFetch.js.map +1 -1
- package/out-tsc/test/NodeHelper.js +25 -27
- package/out-tsc/test/NodeHelper.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +12 -4
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js +101 -91
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_random.test.js +120 -112
- package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_digits.test.js +131 -111
- package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_response.test.js +549 -85
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/out-tsc/test/temba-checkbox.test.js +32 -32
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +2 -1
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-dropdown.test.js +0 -4
- package/out-tsc/test/temba-dropdown.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +9 -4
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-integration-markdown.test.js +13 -15
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
- package/out-tsc/test/temba-node-editor.test.js +5 -38
- package/out-tsc/test/temba-node-editor.test.js.map +1 -1
- package/out-tsc/test/temba-run-list.test.js +2 -2
- package/out-tsc/test/temba-run-list.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +2 -1
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +6 -2
- 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_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.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/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.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_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/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/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/integration/textinput-markdown-errors.png +0 -0
- package/screenshots/truth/lightbox/img-zoomed.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/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/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_llm_categorize/render/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/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/split_by_random/render/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.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/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/verification-code.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/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/templates/default.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/scripts/dev-data-sync.mjs +182 -0
- package/src/display/Chat.ts +6 -4
- package/src/events.ts +6 -5
- package/src/flow/CanvasNode.ts +89 -79
- package/src/flow/Editor.ts +1 -0
- package/src/flow/NodeEditor.ts +55 -3
- package/src/flow/actions/add_contact_groups.ts +16 -1
- package/src/flow/actions/add_contact_urn.ts +1 -1
- package/src/flow/actions/add_input_labels.ts +1 -0
- package/src/flow/actions/set_contact_channel.ts +1 -1
- package/src/flow/actions/set_contact_field.ts +2 -1
- package/src/flow/actions/set_contact_language.ts +3 -1
- package/src/flow/actions/set_contact_name.ts +1 -1
- package/src/flow/actions/set_contact_status.ts +18 -18
- package/src/flow/actions/set_run_result.ts +1 -1
- package/src/flow/nodes/split_by_llm.ts +14 -13
- package/src/flow/nodes/wait_for_response.ts +717 -5
- package/src/flow/operators.ts +215 -0
- package/src/flow/types.ts +10 -2
- package/src/form/ArrayEditor.ts +117 -37
- package/src/form/Checkbox.ts +12 -0
- package/src/form/FieldRenderer.ts +24 -3
- package/src/form/TextInput.ts +19 -1
- package/src/form/select/Select.ts +15 -4
- package/src/interfaces.ts +1 -1
- package/src/layout/Dialog.ts +4 -4
- package/src/list/RunList.ts +2 -2
- package/src/live/ContactChat.ts +144 -58
- package/src/live/ContactDetails.ts +7 -0
- package/src/live/ContactNameFetch.ts +1 -1
- package/static/api/labels.json +6 -1
- package/test/NodeHelper.ts +38 -40
- package/test/nodes/split_by_llm.test.ts +43 -32
- package/test/nodes/split_by_llm_categorize.test.ts +130 -120
- package/test/nodes/split_by_random.test.ts +136 -128
- package/test/nodes/wait_for_digits.test.ts +147 -127
- package/test/nodes/wait_for_response.test.ts +657 -104
- package/test/temba-checkbox.test.ts +36 -32
- package/test/temba-contact-chat.test.ts +2 -1
- package/test/temba-dropdown.test.ts +0 -12
- package/test/temba-flow-editor-node.test.ts +11 -4
- package/test/temba-integration-markdown.test.ts +16 -17
- package/test/temba-node-editor.test.ts +5 -43
- package/test/temba-run-list.test.ts +2 -2
- package/test/utils.test.ts +2 -1
- package/test-assets/list/runs.json +8 -8
- package/web-dev-mock.mjs +86 -30
- package/web-dev-server.config.mjs +272 -31
- package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait_for_response.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_response.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;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C,UAAU,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_response } from '../../src/flow/nodes/wait_for_response';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_response node configuration.\n */\ndescribe('wait_for_response node config', () => {\n const helper = new NodeTest(wait_for_response, 'wait_for_response');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_response.name).to.equal('Wait for Response');\n });\n\n it('has correct type', () => {\n expect(wait_for_response.type).to.equal('wait_for_response');\n });\n\n it('has form configuration', () => {\n expect(wait_for_response.form).to.exist;\n expect(wait_for_response.form.result_name).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(wait_for_response.layout).to.exist;\n expect(wait_for_response.layout).to.deep.equal([\n 'timeout',\n 'result_name'\n ]);\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-wait-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-1',\n seconds: 300\n }\n },\n result_name: 'response',\n categories: [\n {\n uuid: 'timeout-cat-1',\n name: 'No Response',\n exit_uuid: 'timeout-exit-1'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'basic-wait'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-2',\n seconds: 1800\n }\n },\n result_name: 'user_input',\n categories: [\n {\n uuid: 'timeout-cat-2',\n name: 'No Response',\n exit_uuid: 'timeout-exit-2'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'custom-result-name'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-3',\n seconds: 60\n }\n },\n result_name: 'quick_response',\n categories: [\n {\n uuid: 'timeout-cat-3',\n name: 'No Response',\n exit_uuid: 'timeout-exit-3'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'short-timeout'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg'\n // No timeout specified\n },\n result_name: 'response',\n categories: []\n },\n exits: []\n } as Node,\n { type: 'wait_for_response' },\n 'no-timeout'\n );\n });\n\n describe('data transformation', () => {\n it('converts node to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'user_response',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_response.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('user_response');\n });\n\n it('converts form data to node correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n });\n\n it('handles default result name', () => {\n const formData = {\n uuid: 'test-node'\n // No result_name specified\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('response');\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"wait_for_response.test.js","sourceRoot":"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esContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_response } from '../../src/flow/nodes/wait_for_response';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\nimport { createOperatorOption } from '../../src/flow/operators';\n\n/**\n * Test suite for the wait_for_response node configuration.\n */\ndescribe('wait_for_response node config', () => {\n const helper = new NodeTest(wait_for_response, 'wait_for_response');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_response.name).to.equal('Wait for Response');\n });\n\n it('has correct type', () => {\n expect(wait_for_response.type).to.equal('wait_for_response');\n });\n\n it('has form configuration', () => {\n expect(wait_for_response.form).to.exist;\n expect(wait_for_response.form.result_name).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(wait_for_response.layout).to.exist;\n expect(wait_for_response.layout).to.deep.equal(['rules', 'result_name']);\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic wait', async () => {\n await helper.testNode(\n {\n uuid: 'test-wait-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-1',\n seconds: 300\n }\n },\n result_name: 'response',\n categories: [\n {\n uuid: 'timeout-cat-1',\n name: 'No Response',\n exit_uuid: 'timeout-exit-1'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'basic-wait'\n );\n });\n\n it('renders custom result name', async () => {\n await helper.testNode(\n {\n uuid: 'test-wait-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-2',\n seconds: 1800\n }\n },\n result_name: 'user_input',\n categories: [\n {\n uuid: 'timeout-cat-2',\n name: 'No Response',\n exit_uuid: 'timeout-exit-2'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'custom-result-name'\n );\n });\n\n it('renders short timeout', async () => {\n await helper.testNode(\n {\n uuid: 'test-wait-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-3',\n seconds: 60\n }\n },\n result_name: 'quick_response',\n categories: [\n {\n uuid: 'timeout-cat-3',\n name: 'No Response',\n exit_uuid: 'timeout-exit-3'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'short-timeout'\n );\n });\n\n it('renders no timeout', async () => {\n await helper.testNode(\n {\n uuid: 'test-wait-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg'\n // No timeout specified\n },\n result_name: 'response',\n categories: []\n },\n exits: []\n } as Node,\n { type: 'wait_for_response' },\n 'no-timeout'\n );\n });\n });\n\n describe('data transformation', () => {\n it('converts node to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'user_response',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_response.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('user_response');\n expect(formData.rules).to.deep.equal([]);\n });\n\n it('converts node with rules to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'user_response',\n operand: '@input.text',\n categories: [\n {\n uuid: 'red-cat',\n name: 'Red',\n exit_uuid: 'red-exit'\n },\n {\n uuid: 'green-cat',\n name: 'Green',\n exit_uuid: 'green-exit'\n },\n {\n uuid: 'other-cat',\n name: 'Other',\n exit_uuid: 'other-exit'\n }\n ],\n cases: [\n {\n uuid: 'red-case',\n type: 'has_any_word',\n arguments: ['red'],\n category_uuid: 'red-cat'\n },\n {\n uuid: 'green-case',\n type: 'has_phrase',\n arguments: ['green'],\n category_uuid: 'green-cat'\n }\n ]\n },\n exits: [\n { uuid: 'red-exit', destination_uuid: null },\n { uuid: 'green-exit', destination_uuid: null },\n { uuid: 'other-exit', destination_uuid: null }\n ]\n };\n\n const formData = wait_for_response.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('user_response');\n expect(formData.rules).to.have.length(2);\n expect(formData.rules[0]).to.deep.equal({\n operator: createOperatorOption('has_any_word'),\n value1: 'red',\n value2: '',\n category: 'Red'\n });\n expect(formData.rules[1]).to.deep.equal({\n operator: createOperatorOption('has_phrase'),\n value1: 'green',\n value2: '',\n category: 'Green'\n });\n });\n\n it('converts form data to node correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response',\n rules: []\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n });\n\n it('converts form data with rules to node correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response',\n rules: [\n {\n operator: 'has_any_word',\n value1: 'red',\n value2: '',\n category: 'Red'\n },\n {\n operator: 'has_phrase',\n value1: 'blue',\n value2: '',\n category: 'Blue'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n expect(result.router?.operand).to.equal('@input.text');\n expect(result.router?.categories).to.have.length(3); // Red, Blue, Other\n expect(result.router?.cases).to.have.length(2);\n expect(result.exits).to.have.length(3);\n\n // Check categories\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members(['Red', 'Blue', 'Other']);\n\n // Check cases\n const redCase = result.router!.cases.find(\n (c) => c.type === 'has_any_word'\n );\n expect(redCase).to.exist;\n expect(redCase!.arguments).to.deep.equal(['red']);\n\n const blueCase = result.router!.cases.find(\n (c) => c.type === 'has_phrase'\n );\n expect(blueCase).to.exist;\n expect(blueCase!.arguments).to.deep.equal(['blue']);\n });\n\n it('handles default result name', () => {\n const formData = {\n uuid: 'test-node',\n rules: []\n // No result_name specified\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('response');\n });\n\n it('handles operators with no operands correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response',\n rules: [\n {\n operator: 'has_text',\n value: '', // No value needed for has_text\n category: 'Has Text'\n },\n {\n operator: 'has_number',\n value: '', // No value needed for has_number\n category: 'Has Number'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n expect(result.router?.categories).to.have.length(3); // Has Text, Has Number, Other\n expect(result.router?.cases).to.have.length(2);\n expect(result.exits).to.have.length(3);\n\n // Check categories\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members([\n 'Has Text',\n 'Has Number',\n 'Other'\n ]);\n\n // Check cases - should have empty arguments for 0-operand operators\n const hasTextCase = result.router!.cases.find(\n (c) => c.type === 'has_text'\n );\n expect(hasTextCase).to.exist;\n expect(hasTextCase!.arguments).to.deep.equal([]);\n\n const hasNumberCase = result.router!.cases.find(\n (c) => c.type === 'has_number'\n );\n expect(hasNumberCase).to.exist;\n expect(hasNumberCase!.arguments).to.deep.equal([]);\n });\n\n it('preserves timeout categories when adding rules', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'response',\n timeout_enabled: true,\n timeout_duration: [{ value: '300', name: '5 minutes' }],\n rules: [\n {\n operator: 'has_text',\n value: 'yes',\n category: 'Positive'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat',\n seconds: 300\n }\n },\n result_name: 'response',\n categories: [\n {\n uuid: 'timeout-cat',\n name: 'No Response',\n exit_uuid: 'timeout-exit'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit', destination_uuid: null }]\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.router?.categories).to.have.length(3); // Positive, No Response, Other\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members([\n 'Positive',\n 'No Response',\n 'Other'\n ]);\n\n // Verify timeout configuration is preserved\n expect(result.router?.wait).to.exist;\n expect(result.router?.wait?.timeout?.category_uuid).to.equal(\n 'timeout-cat'\n );\n });\n });\n\n describe('validation', () => {\n it('validates form data correctly with no errors', () => {\n const formData = {\n rules: [\n { operator: 'has_text', value: 'yes', category: 'Positive' },\n { operator: 'has_text', value: 'no', category: 'Negative' }\n ]\n };\n\n const validation = wait_for_response.validate!(formData);\n expect(validation.valid).to.be.true;\n expect(validation.errors).to.be.empty;\n });\n\n it('allows same category names for multiple rules', () => {\n const formData = {\n rules: [\n { operator: 'has_text', value: 'yes', category: 'Positive' },\n { operator: 'has_text', value: 'ok', category: 'positive' }, // case insensitive same category\n { operator: 'has_text', value: 'no', category: 'Negative' }\n ]\n };\n\n const validation = wait_for_response.validate!(formData);\n expect(validation.valid).to.be.true;\n expect(validation.errors).to.be.empty;\n });\n\n it('allows rules with operators that need no values', () => {\n const formData = {\n rules: [\n { operator: 'has_text', value: '', category: 'Has Text' },\n { operator: 'has_number', value: '', category: 'Has Number' },\n { operator: 'has_any_word', value: 'hello', category: 'Greeting' }\n ]\n };\n\n const validation = wait_for_response.validate!(formData);\n expect(validation.valid).to.be.true;\n expect(validation.errors).to.be.empty;\n });\n\n it('ignores empty rules in validation', () => {\n const formData = {\n rules: [\n { operator: 'has_phrase', value: 'yes', category: 'Positive' },\n { operator: '', value: '', category: '' }, // empty rule\n { operator: 'has_phrase', value: 'no', category: 'Negative' }\n ]\n };\n\n const validation = wait_for_response.validate!(formData);\n expect(validation.valid).to.be.true;\n expect(validation.errors).to.be.empty;\n });\n\n it('preserves category UUIDs when names are updated', () => {\n // Create original node with specific UUIDs\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: [\n {\n uuid: 'category-1-uuid',\n name: 'Old Name 1',\n exit_uuid: 'exit-1-uuid'\n },\n {\n uuid: 'category-2-uuid',\n name: 'Old Name 2',\n exit_uuid: 'exit-2-uuid'\n },\n {\n uuid: 'other-category-uuid',\n name: 'Other',\n exit_uuid: 'other-exit-uuid'\n }\n ],\n cases: [\n {\n uuid: 'case-1-uuid',\n type: 'has_phrase',\n arguments: ['yes'],\n category_uuid: 'category-1-uuid'\n },\n {\n uuid: 'case-2-uuid',\n type: 'has_phrase',\n arguments: ['no'],\n category_uuid: 'category-2-uuid'\n }\n ]\n },\n exits: [\n { uuid: 'exit-1-uuid', destination_uuid: null },\n { uuid: 'exit-2-uuid', destination_uuid: null },\n { uuid: 'other-exit-uuid', destination_uuid: null }\n ]\n };\n\n // Update category names but keep same rules in same order\n const formData = {\n uuid: 'test-node',\n result_name: 'response',\n rules: [\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'yes',\n category: 'New Name 1' // Changed from \"Old Name 1\"\n },\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'no',\n category: 'New Name 2' // Changed from \"Old Name 2\"\n }\n ]\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n // Verify that UUIDs are preserved despite name changes\n expect(result.router?.categories).to.have.length(3); // Two rules + Other\n\n const category1 = result.router!.categories.find(\n (cat) => cat.name === 'New Name 1'\n );\n const category2 = result.router!.categories.find(\n (cat) => cat.name === 'New Name 2'\n );\n const otherCategory = result.router!.categories.find(\n (cat) => cat.name === 'Other'\n );\n\n // Verify UUIDs are preserved\n expect(category1?.uuid).to.equal('category-1-uuid');\n expect(category1?.exit_uuid).to.equal('exit-1-uuid');\n\n expect(category2?.uuid).to.equal('category-2-uuid');\n expect(category2?.exit_uuid).to.equal('exit-2-uuid');\n\n expect(otherCategory?.uuid).to.equal('other-category-uuid');\n expect(otherCategory?.exit_uuid).to.equal('other-exit-uuid');\n\n // Verify case UUIDs are also preserved\n const case1 = result.router!.cases.find(\n (c) => c.category_uuid === 'category-1-uuid'\n );\n const case2 = result.router!.cases.find(\n (c) => c.category_uuid === 'category-2-uuid'\n );\n\n expect(case1?.uuid).to.equal('case-1-uuid');\n expect(case2?.uuid).to.equal('case-2-uuid');\n\n // Verify exits are preserved\n expect(result.exits).to.have.length(3);\n expect(result.exits.map((e) => e.uuid)).to.include.members([\n 'exit-1-uuid',\n 'exit-2-uuid',\n 'other-exit-uuid'\n ]);\n });\n\n it('merges rules with same category name into single category', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'response',\n rules: [\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'yes',\n category: 'Positive'\n },\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'ok',\n category: 'Positive' // Same category name\n },\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'no',\n category: 'Negative'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: [],\n cases: []\n },\n exits: []\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n // Should have 3 categories: Positive, Negative, Other\n expect(result.router?.categories).to.have.length(3);\n\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.include.members([\n 'Positive',\n 'Negative',\n 'Other'\n ]);\n\n // Should have 3 cases but only 2 user categories (+ Other)\n expect(result.router?.cases).to.have.length(3);\n\n // Both \"yes\" and \"ok\" rules should reference the same Positive category\n const positiveCategory = result.router!.categories.find(\n (cat) => cat.name === 'Positive'\n );\n expect(positiveCategory).to.exist;\n\n const positiveCases = result.router!.cases.filter(\n (case_) => case_.category_uuid === positiveCategory!.uuid\n );\n expect(positiveCases).to.have.length(2);\n\n // Verify the cases have the correct arguments\n const yesCase = positiveCases.find((case_) =>\n case_.arguments.includes('yes')\n );\n const okCase = positiveCases.find((case_) =>\n case_.arguments.includes('ok')\n );\n\n expect(yesCase).to.exist;\n expect(okCase).to.exist;\n\n // Should have 3 exits: Positive, Negative, Other\n expect(result.exits).to.have.length(3);\n });\n\n it('preserves category order when merging same category names', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'response',\n rules: [\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'yes',\n category: 'First'\n },\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'maybe',\n category: 'Second'\n },\n {\n operator: { value: 'has_phrase', name: 'contains phrase' },\n value1: 'ok',\n category: 'First' // Same as first rule\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: [],\n cases: []\n },\n exits: []\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n // Should have 3 categories: First, Second, Other (in that order)\n expect(result.router?.categories).to.have.length(3);\n\n const categoryNames = result.router!.categories.map((cat) => cat.name);\n expect(categoryNames).to.deep.equal(['First', 'Second', 'Other']);\n\n // First category should have 2 cases (yes and ok)\n const firstCategory = result.router!.categories.find(\n (cat) => cat.name === 'First'\n );\n const firstCases = result.router!.cases.filter(\n (case_) => case_.category_uuid === firstCategory!.uuid\n );\n expect(firstCases).to.have.length(2);\n\n // Second category should have 1 case (maybe)\n const secondCategory = result.router!.categories.find(\n (cat) => cat.name === 'Second'\n );\n const secondCases = result.router!.cases.filter(\n (case_) => case_.category_uuid === secondCategory!.uuid\n );\n expect(secondCases).to.have.length(1);\n });\n });\n});\n"]}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
-
import { assertScreenshot, getClip } from './utils.test';
|
|
2
|
+
import { assertScreenshot, getClip, getComponent } from './utils.test';
|
|
3
|
+
const getCheckbox = async (props) => {
|
|
4
|
+
return (await getComponent('temba-checkbox', props));
|
|
5
|
+
};
|
|
3
6
|
describe('temba-checkbox', () => {
|
|
4
7
|
it('renders default checkbox', async () => {
|
|
5
|
-
const el = await
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const el = await getCheckbox({
|
|
9
|
+
label: 'My Checkbox'
|
|
10
|
+
});
|
|
8
11
|
expect(el.label).to.equal('My Checkbox');
|
|
9
12
|
await assertScreenshot('checkbox/default', getClip(el));
|
|
10
13
|
});
|
|
11
14
|
it('can select by clicking on the label', async () => {
|
|
12
|
-
const el = await
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
></temba-checkbox>
|
|
17
|
-
`);
|
|
15
|
+
const el = await getCheckbox({
|
|
16
|
+
label: 'My Checkbox',
|
|
17
|
+
animatechange: false
|
|
18
|
+
});
|
|
18
19
|
el.shadowRoot.querySelector('.checkbox-label').click();
|
|
19
20
|
expect(el.checked).to.equal(true);
|
|
20
21
|
await assertScreenshot('checkbox/checked', getClip(el));
|
|
@@ -22,9 +23,9 @@ describe('temba-checkbox', () => {
|
|
|
22
23
|
it('fires change event on click', async () => {
|
|
23
24
|
// eslint-disable-next-line no-async-promise-executor
|
|
24
25
|
return new Promise(async (resolve) => {
|
|
25
|
-
const checkbox = await
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const checkbox = await getCheckbox({
|
|
27
|
+
label: 'My Checkbox'
|
|
28
|
+
});
|
|
28
29
|
checkbox.addEventListener('change', () => {
|
|
29
30
|
resolve();
|
|
30
31
|
});
|
|
@@ -32,16 +33,17 @@ describe('temba-checkbox', () => {
|
|
|
32
33
|
});
|
|
33
34
|
});
|
|
34
35
|
it('checks via click method', async () => {
|
|
35
|
-
const checkbox = await
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const checkbox = await getCheckbox({
|
|
37
|
+
label: 'My Checkbox'
|
|
38
|
+
});
|
|
38
39
|
checkbox.click();
|
|
39
40
|
expect(checkbox.checked).to.equal(true);
|
|
40
41
|
});
|
|
41
42
|
it('has background hover effect when label is set', async () => {
|
|
42
|
-
const el = await
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const el = await getCheckbox({
|
|
44
|
+
label: 'My Label',
|
|
45
|
+
name: 'My Checkbox'
|
|
46
|
+
});
|
|
45
47
|
expect(el.label).to.equal('My Label');
|
|
46
48
|
//the ".wrapper.label" style results in the background hover effect
|
|
47
49
|
const wrapperDivEl = el.shadowRoot.querySelector('div.wrapper.label');
|
|
@@ -52,9 +54,9 @@ describe('temba-checkbox', () => {
|
|
|
52
54
|
//but this is the expected behavior if the label value is still empty,
|
|
53
55
|
//upon rendering the component
|
|
54
56
|
it('has no background hover effect when label is empty', async () => {
|
|
55
|
-
const el = await
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
const el = await getCheckbox({
|
|
58
|
+
name: 'My Checkbox'
|
|
59
|
+
});
|
|
58
60
|
expect(el.label).to.equal(undefined);
|
|
59
61
|
//the ".wrapper.label" style results in the background hover effect
|
|
60
62
|
const wrapperDivEl = el.shadowRoot.querySelector('div.wrapper.label');
|
|
@@ -62,9 +64,10 @@ describe('temba-checkbox', () => {
|
|
|
62
64
|
await assertScreenshot('checkbox/checkbox-no-label-no-background-hover', getClip(el));
|
|
63
65
|
});
|
|
64
66
|
it('has no background hover effect when label is whitespace', async () => {
|
|
65
|
-
const el = await
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
const el = await getCheckbox({
|
|
68
|
+
name: 'My Checkbox',
|
|
69
|
+
label: ''
|
|
70
|
+
});
|
|
68
71
|
expect(el.label).to.equal('');
|
|
69
72
|
//the ".wrapper.label" style results in the background hover effect
|
|
70
73
|
const wrapperDivEl = el.shadowRoot.querySelector('div.wrapper.label');
|
|
@@ -126,13 +129,10 @@ describe('temba-checkbox', () => {
|
|
|
126
129
|
expect(data.get('my-cb')).to.equal('5');
|
|
127
130
|
});
|
|
128
131
|
it('aligns help text with label when both are present', async () => {
|
|
129
|
-
const el = await
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
>
|
|
134
|
-
</temba-checkbox>
|
|
135
|
-
`);
|
|
132
|
+
const el = (await getCheckbox({
|
|
133
|
+
label: 'Checkbox with help',
|
|
134
|
+
help_text: 'This help text should align with the label text'
|
|
135
|
+
}));
|
|
136
136
|
expect(el.label).to.equal('Checkbox with help');
|
|
137
137
|
expect(el.helpText).to.equal('This help text should align with the label text');
|
|
138
138
|
// Verify help text element exists and has proper alignment styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-checkbox.test.js","sourceRoot":"","sources":["../../test/temba-checkbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,EAAE,GAAa,MAAM,OAAO,CAAC,IAAI,CAAA;;KAEtC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACzC,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,EAAE,GAAa,MAAM,OAAO,CAAC,IAAI,CAAA;;;;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,IAAI,CAAA;;;;;;KAMtC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAChD,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAC1B,iDAAiD,CAClD,CAAC;QAEF,kEAAkE;QAClE,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAC5C,qBAAqB,CACP,CAAC;QACjB,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAC5C,iDAAiD,CAClD,CAAC;QAEF,MAAM,gBAAgB,CAAC,kCAAkC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport { Checkbox } from '../src/form/Checkbox';\nimport { assertScreenshot, getClip } from './utils.test';\n\ndescribe('temba-checkbox', () => {\n it('renders default checkbox', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox label=\"My Checkbox\"></temba-checkbox>\n `);\n\n expect(el.label).to.equal('My Checkbox');\n await assertScreenshot('checkbox/default', getClip(el));\n });\n\n it('can select by clicking on the label', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox\n label=\"My Checkbox\"\n animatechange=\"false\"\n ></temba-checkbox>\n `);\n\n (el.shadowRoot.querySelector('.checkbox-label') as HTMLDivElement).click();\n expect(el.checked).to.equal(true);\n await assertScreenshot('checkbox/checked', getClip(el));\n });\n\n it('fires change event on click', async () => {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<void>(async (resolve) => {\n const checkbox: Checkbox = await fixture(html`\n <temba-checkbox label=\"My Checkbox\"></temba-checkbox>\n `);\n\n checkbox.addEventListener('change', () => {\n resolve();\n });\n\n click('temba-checkbox');\n });\n });\n\n it('checks via click method', async () => {\n const checkbox: Checkbox = await fixture(html`\n <temba-checkbox label=\"My Checkbox\"></temba-checkbox>\n `);\n checkbox.click();\n expect(checkbox.checked).to.equal(true);\n });\n\n it('has background hover effect when label is set', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox name=\"My Checkbox\" label=\"My Label\"></temba-checkbox>\n `);\n expect(el.label).to.equal('My Label');\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.not.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-label-background-hover',\n getClip(el)\n );\n });\n\n //note: sometimes upstream logic sets an empty checkbox label to the name value,\n //but this is the expected behavior if the label value is still empty,\n //upon rendering the component\n it('has no background hover effect when label is empty', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox name=\"My Checkbox\"></temba-checkbox>\n `);\n expect(el.label).to.equal(undefined);\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-no-label-no-background-hover',\n getClip(el)\n );\n });\n\n it('has no background hover effect when label is whitespace', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox name=\"My Checkbox\" label=\" \"></temba-checkbox>\n `);\n expect(el.label).to.equal('');\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-whitespace-label-no-background-hover',\n getClip(el)\n );\n });\n\n it('submits as boolean without value', async () => {\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // if we didn't click it, it shouldn't be in the form data\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('1');\n });\n\n it('supports custom values', async () => {\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\" value=\"3\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // if we didn't click it, it shouldn't be in the form data\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('3');\n });\n\n it('supports programmtically updated values', async () => {\n // start with empty value\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // update our value directly\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n checkbox.value = '5';\n\n // we set a custom value, but we still aren't checked\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('5');\n });\n\n it('aligns help text with label when both are present', async () => {\n const el: Checkbox = await fixture(html`\n <temba-checkbox\n label=\"Checkbox with help\"\n help_text=\"This help text should align with the label text\"\n >\n </temba-checkbox>\n `);\n\n expect(el.label).to.equal('Checkbox with help');\n expect(el.helpText).to.equal(\n 'This help text should align with the label text'\n );\n\n // Verify help text element exists and has proper alignment styles\n const helpTextEl = el.shadowRoot.querySelector(\n '.checkbox-help-text'\n ) as HTMLElement;\n expect(helpTextEl).to.not.be.null;\n expect(helpTextEl.textContent.trim()).to.equal(\n 'This help text should align with the label text'\n );\n\n await assertScreenshot('checkbox/checkbox-with-help-text', getClip(el));\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"temba-checkbox.test.js","sourceRoot":"","sources":["../../test/temba-checkbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,WAAW,GAAG,KAAK,EAAE,KAAU,EAAE,EAAE;IACvC,OAAO,CAAC,MAAM,YAAY,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAa,CAAC;AACnE,CAAC,CAAC;AAEF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,EAAE,GAAG,MAAM,WAAW,CAAC;YAC3B,KAAK,EAAE,aAAa;SACrB,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACzC,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,EAAE,GAAa,MAAM,WAAW,CAAC;YACrC,KAAK,EAAE,aAAa;YACpB,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;QAEF,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,iBAAiB,CAAoB,CAAC,KAAK,EAAE,CAAC;QAC3E,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;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,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAChD,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAC1B,iDAAiD,CAClD,CAAC;QAEF,kEAAkE;QAClE,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAC5C,qBAAqB,CACP,CAAC;QACjB,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QAClC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAC5C,iDAAiD,CAClD,CAAC;QAEF,MAAM,gBAAgB,CAAC,kCAAkC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport { Checkbox } from '../src/form/Checkbox';\nimport { assertScreenshot, getClip, getComponent } from './utils.test';\n\nconst getCheckbox = async (props: any) => {\n return (await getComponent('temba-checkbox', props)) as Checkbox;\n};\n\ndescribe('temba-checkbox', () => {\n it('renders default checkbox', async () => {\n const el = await getCheckbox({\n label: 'My Checkbox'\n });\n\n expect(el.label).to.equal('My Checkbox');\n await assertScreenshot('checkbox/default', getClip(el));\n });\n\n it('can select by clicking on the label', async () => {\n const el: Checkbox = await getCheckbox({\n label: 'My Checkbox',\n animatechange: false\n });\n\n (el.shadowRoot.querySelector('.checkbox-label') as HTMLDivElement).click();\n expect(el.checked).to.equal(true);\n await assertScreenshot('checkbox/checked', getClip(el));\n });\n\n it('fires change event on click', async () => {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<void>(async (resolve) => {\n const checkbox = await getCheckbox({\n label: 'My Checkbox'\n });\n\n checkbox.addEventListener('change', () => {\n resolve();\n });\n\n click('temba-checkbox');\n });\n });\n\n it('checks via click method', async () => {\n const checkbox = await getCheckbox({\n label: 'My Checkbox'\n });\n checkbox.click();\n expect(checkbox.checked).to.equal(true);\n });\n\n it('has background hover effect when label is set', async () => {\n const el: Checkbox = await getCheckbox({\n label: 'My Label',\n name: 'My Checkbox'\n });\n\n expect(el.label).to.equal('My Label');\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.not.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-label-background-hover',\n getClip(el)\n );\n });\n\n //note: sometimes upstream logic sets an empty checkbox label to the name value,\n //but this is the expected behavior if the label value is still empty,\n //upon rendering the component\n it('has no background hover effect when label is empty', async () => {\n const el: Checkbox = await getCheckbox({\n name: 'My Checkbox'\n });\n\n expect(el.label).to.equal(undefined);\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-no-label-no-background-hover',\n getClip(el)\n );\n });\n\n it('has no background hover effect when label is whitespace', async () => {\n const el: Checkbox = await getCheckbox({\n name: 'My Checkbox',\n label: ''\n });\n\n expect(el.label).to.equal('');\n //the \".wrapper.label\" style results in the background hover effect\n const wrapperDivEl = el.shadowRoot.querySelector(\n 'div.wrapper.label'\n ) as HTMLDivElement;\n expect(wrapperDivEl).to.equal(null);\n await assertScreenshot(\n 'checkbox/checkbox-whitespace-label-no-background-hover',\n getClip(el)\n );\n });\n\n it('submits as boolean without value', async () => {\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // if we didn't click it, it shouldn't be in the form data\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('1');\n });\n\n it('supports custom values', async () => {\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\" value=\"3\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // if we didn't click it, it shouldn't be in the form data\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('3');\n });\n\n it('supports programmtically updated values', async () => {\n // start with empty value\n const form = (await fixture(html`\n <form>\n <temba-checkbox name=\"my-cb\"></temba-checkbox>\n </form>\n `)) as HTMLFormElement;\n\n // update our value directly\n const checkbox = form.querySelector('temba-checkbox') as Checkbox;\n checkbox.value = '5';\n\n // we set a custom value, but we still aren't checked\n let data = new FormData(form);\n expect(data.get('my-cb')).to.equal(null);\n\n // click our checkbox\n await click('temba-checkbox');\n expect(checkbox.checked).to.equal(true);\n\n // clicking a non-value checkbox should set it to 1\n data = new FormData(form);\n expect(data.get('my-cb')).to.equal('5');\n });\n\n it('aligns help text with label when both are present', async () => {\n const el: Checkbox = (await getCheckbox({\n label: 'Checkbox with help',\n help_text: 'This help text should align with the label text'\n })) as unknown as Checkbox;\n\n expect(el.label).to.equal('Checkbox with help');\n expect(el.helpText).to.equal(\n 'This help text should align with the label text'\n );\n\n // Verify help text element exists and has proper alignment styles\n const helpTextEl = el.shadowRoot.querySelector(\n '.checkbox-help-text'\n ) as HTMLElement;\n expect(helpTextEl).to.not.be.null;\n expect(helpTextEl.textContent.trim()).to.equal(\n 'This help text should align with the label text'\n );\n\n await assertScreenshot('checkbox/checkbox-with-help-text', getClip(el));\n });\n});\n"]}
|
|
@@ -35,7 +35,8 @@ describe('temba-contact-chat', () => {
|
|
|
35
35
|
clock.restore();
|
|
36
36
|
mockedNow.restore();
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
// temporarily disabled as it's too flaky in CI
|
|
39
|
+
xit('show history and show chatbox if contact is active', async () => {
|
|
39
40
|
// we are a StoreElement, so load a store first
|
|
40
41
|
await loadStore();
|
|
41
42
|
const chat = await getContactChat({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-contact-chat.test.js","sourceRoot":"","sources":["../../test/temba-contact-chat.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEpD,IAAI,KAAU,CAAC;AAEf,MAAM,GAAG,GAAG,oBAAoB,CAAC;AACjC,MAAM,cAAc,GAAG,KAAK,EAAE,QAAa,EAAE,EAAE,EAAE;IAC/C,KAAK,CAAC,UAAU,CAAC,GAAG,wBAAwB,CAAC;IAC7C,gEAAgE;IAChE,MAAM,IAAI,GAAG,CAAC,MAAM,YAAY,CAC9B,GAAG,EACH,KAAK,EACL,EAAE,EACF,GAAG,EACH,GAAG,EACH,8DAA8D,CAC/D,CAAgB,CAAC;IAElB,oDAAoD;IACpD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,WAAyB,EAAE,EAAE;IAC5D,M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J,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,+CAA+C;QAC/C,MAAM,SAAS,EAAE,CAAC;QAClB,MAAM,IAAI,GAAgB,MAAM,cAAc,CAAC;YAC7C,OAAO,EAAE,qBAAqB;SAC/B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,eAAe,CAAY,CAAC;QAC1E,MAAM,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAEtE,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAC5B,MAAM,eAAe,GAAG,KAAK,CAAC;QAC9B,QAAQ,CACN,yBAAyB,EACzB,aAAa,EACb,gBAAgB,EAChB,eAAe,CAChB,CAAC;QAEF,QAAQ;QACR,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACrE,MAAM,QAAQ,CAAC,kCAAkC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAEhC,MAAM,gBAAgB,CAAC,uBAAuB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SinonStub, useFakeTimers } from 'sinon';\nimport { Compose } from '../src/form/Compose';\nimport { ContactChat } from '../src/live/ContactChat';\nimport { Attachment, CustomEventType } from '../src/interfaces';\nimport {\n assertScreenshot,\n clearMockPosts,\n getClip,\n getComponent,\n getValidAttachments,\n getValidText,\n loadStore,\n mockAPI,\n mockGET,\n mockNow,\n mockPOST,\n updateComponent\n} from '../test/utils.test';\n\nimport { expect, oneEvent } from '@open-wc/testing';\n\nlet clock: any;\n\nconst TAG = 'temba-contact-chat';\nconst getContactChat = async (attrs: any = {}) => {\n attrs['endpoint'] = '/test-assets/contacts/';\n // add some sizes and styles to force our chat history to scroll\n const chat = (await getComponent(\n TAG,\n attrs,\n '',\n 500,\n 500,\n 'display:flex;flex-direction:column;flex-grow:1;min-height:0;'\n )) as ContactChat;\n\n // TODO: this should be waiting for an event instead\n await waitFor(100);\n await clock.tick(0);\n return chat;\n};\n\nconst getResponseSuccessFiles = (attachments: Attachment[]) => {\n const response_attachments = attachments.map((attachment) => {\n return { content_type: attachment.content_type, url: attachment.url };\n });\n return response_attachments;\n};\n\ndescribe('temba-contact-chat', () => {\n let mockedNow: SinonStub;\n // map requests for contact history to our static files\n // we'll just us the same historylist for everybody for now\n beforeEach(() => {\n mockedNow = mockNow('2021-03-31T00:31:00.000-00:00');\n clearMockPosts();\n mockGET(\n /\\/contact\\/history\\/contact-.*/,\n '/test-assets/contacts/history.json'\n );\n\n mockGET(\n /\\/api\\/v2\\/users\\.json\\?email=admin1%40nyaruka\\.com/,\n '/test-assets/api/users/admin1.json'\n );\n\n mockAPI();\n clock = useFakeTimers();\n });\n\n afterEach(function () {\n clock.restore();\n mockedNow.restore();\n });\n\n it('show history and show chatbox if contact is active', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n\n await assertScreenshot('contacts/chat-for-active-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is archived', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-barack-archived'\n });\n\n await assertScreenshot('contacts/chat-for-archived-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is blocked', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-michelle-blocked'\n });\n\n await assertScreenshot('contacts/chat-for-blocked-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is stopped', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-tim-stopped'\n });\n\n await assertScreenshot('contacts/chat-for-stopped-contact', getClip(chat));\n });\n\n it('sends text without attachments', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const text = getValidText();\n await updateComponent(compose, text);\n\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: text,\n attachments: []\n };\n mockPOST(/api\\/v2\\/messages\\.json/, response_body);\n\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', text, true, true);\n expect(await listener).to.exist;\n\n await assertScreenshot('contacts/chat-sends-text-only', getClip(chat));\n });\n\n it('sends attachments without text', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const attachments = getValidAttachments();\n await updateComponent(compose, null, attachments);\n const response_attachments = getResponseSuccessFiles(attachments);\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: '',\n attachments: response_attachments\n };\n const response_headers = {};\n const response_status = '200';\n mockPOST(\n /api\\/v2\\/messages\\.json/,\n response_body,\n response_headers,\n response_status\n );\n\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot(\n 'contacts/chat-sends-attachments-only',\n getClip(chat)\n );\n });\n\n it('sends text with attachments', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const text = getValidText();\n const attachments = getValidAttachments();\n await updateComponent(compose, text, attachments);\n const response_attachments = getResponseSuccessFiles(attachments);\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: text,\n attachments: response_attachments\n };\n mockPOST(/api\\/v2\\/messages\\.json/, response_body);\n\n // press enter\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot(\n 'contacts/chat-sends-text-and-attachments',\n getClip(chat)\n );\n });\n\n it('shows failure message with retry', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n await updateComponent(compose, getValidText(), getValidAttachments());\n\n const response_body = {};\n const response_headers = {};\n const response_status = '500';\n mockPOST(\n /api\\/v2\\/messages\\.json/,\n response_body,\n response_headers,\n response_status\n );\n\n // press\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot('contacts/chat-failure', getClip(chat));\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"temba-contact-chat.test.js","sourceRoot":"","sources":["../../test/temba-contact-chat.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAc,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEpD,IAAI,KAAU,CAAC;AAEf,MAAM,GAAG,GAAG,oBAAoB,CAAC;AACjC,MAAM,cAAc,GAAG,KAAK,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CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAEhC,MAAM,gBAAgB,CAAC,uBAAuB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SinonStub, useFakeTimers } from 'sinon';\nimport { Compose } from '../src/form/Compose';\nimport { ContactChat } from '../src/live/ContactChat';\nimport { Attachment, CustomEventType } from '../src/interfaces';\nimport {\n assertScreenshot,\n clearMockPosts,\n getClip,\n getComponent,\n getValidAttachments,\n getValidText,\n loadStore,\n mockAPI,\n mockGET,\n mockNow,\n mockPOST,\n updateComponent\n} from '../test/utils.test';\n\nimport { expect, oneEvent } from '@open-wc/testing';\n\nlet clock: any;\n\nconst TAG = 'temba-contact-chat';\nconst getContactChat = async (attrs: any = {}) => {\n attrs['endpoint'] = '/test-assets/contacts/';\n // add some sizes and styles to force our chat history to scroll\n const chat = (await getComponent(\n TAG,\n attrs,\n '',\n 500,\n 500,\n 'display:flex;flex-direction:column;flex-grow:1;min-height:0;'\n )) as ContactChat;\n\n // TODO: this should be waiting for an event instead\n await waitFor(100);\n await clock.tick(0);\n return chat;\n};\n\nconst getResponseSuccessFiles = (attachments: Attachment[]) => {\n const response_attachments = attachments.map((attachment) => {\n return { content_type: attachment.content_type, url: attachment.url };\n });\n return response_attachments;\n};\n\ndescribe('temba-contact-chat', () => {\n let mockedNow: SinonStub;\n // map requests for contact history to our static files\n // we'll just us the same historylist for everybody for now\n beforeEach(() => {\n mockedNow = mockNow('2021-03-31T00:31:00.000-00:00');\n clearMockPosts();\n mockGET(\n /\\/contact\\/history\\/contact-.*/,\n '/test-assets/contacts/history.json'\n );\n\n mockGET(\n /\\/api\\/v2\\/users\\.json\\?email=admin1%40nyaruka\\.com/,\n '/test-assets/api/users/admin1.json'\n );\n\n mockAPI();\n clock = useFakeTimers();\n });\n\n afterEach(function () {\n clock.restore();\n mockedNow.restore();\n });\n\n // temporarily disabled as it's too flaky in CI\n xit('show history and show chatbox if contact is active', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n\n await assertScreenshot('contacts/chat-for-active-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is archived', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-barack-archived'\n });\n\n await assertScreenshot('contacts/chat-for-archived-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is blocked', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-michelle-blocked'\n });\n\n await assertScreenshot('contacts/chat-for-blocked-contact', getClip(chat));\n });\n\n it('show history and hide chatbox if contact is stopped', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-tim-stopped'\n });\n\n await assertScreenshot('contacts/chat-for-stopped-contact', getClip(chat));\n });\n\n it('sends text without attachments', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const text = getValidText();\n await updateComponent(compose, text);\n\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: text,\n attachments: []\n };\n mockPOST(/api\\/v2\\/messages\\.json/, response_body);\n\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', text, true, true);\n expect(await listener).to.exist;\n\n await assertScreenshot('contacts/chat-sends-text-only', getClip(chat));\n });\n\n it('sends attachments without text', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const attachments = getValidAttachments();\n await updateComponent(compose, null, attachments);\n const response_attachments = getResponseSuccessFiles(attachments);\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: '',\n attachments: response_attachments\n };\n const response_headers = {};\n const response_status = '200';\n mockPOST(\n /api\\/v2\\/messages\\.json/,\n response_body,\n response_headers,\n response_status\n );\n\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot(\n 'contacts/chat-sends-attachments-only',\n getClip(chat)\n );\n });\n\n it('sends text with attachments', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n const text = getValidText();\n const attachments = getValidAttachments();\n await updateComponent(compose, text, attachments);\n const response_attachments = getResponseSuccessFiles(attachments);\n const response_body = {\n contact: { uuid: 'contact-dave-active', name: 'Dave Matthews' },\n text: text,\n attachments: response_attachments\n };\n mockPOST(/api\\/v2\\/messages\\.json/, response_body);\n\n // press enter\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot(\n 'contacts/chat-sends-text-and-attachments',\n getClip(chat)\n );\n });\n\n it('shows failure message with retry', async () => {\n // we are a StoreElement, so load a store first\n await loadStore();\n const chat: ContactChat = await getContactChat({\n contact: 'contact-dave-active'\n });\n const compose = chat.shadowRoot.querySelector('temba-compose') as Compose;\n await updateComponent(compose, getValidText(), getValidAttachments());\n\n const response_body = {};\n const response_headers = {};\n const response_status = '500';\n mockPOST(\n /api\\/v2\\/messages\\.json/,\n response_body,\n response_headers,\n response_status\n );\n\n // press\n const listener = oneEvent(compose, CustomEventType.Submitted, false);\n await typeInto('temba-contact-chat:temba-compose', '', false, true);\n expect(await listener).to.exist;\n\n await assertScreenshot('contacts/chat-failure', getClip(chat));\n });\n});\n"]}
|
|
@@ -205,8 +205,6 @@ describe(TAG, () => {
|
|
|
205
205
|
await waitForStableRender(dropdown);
|
|
206
206
|
// Verify position was adjusted for right edge
|
|
207
207
|
expect(dropdown.dropdownStyle).to.have.property('left');
|
|
208
|
-
// Screenshot positioned dropdown
|
|
209
|
-
await assertScreenshot('dropdown/right-edge-collision', getDropdownClip(dropdown));
|
|
210
208
|
}
|
|
211
209
|
finally {
|
|
212
210
|
// Restore original method
|
|
@@ -244,8 +242,6 @@ describe(TAG, () => {
|
|
|
244
242
|
expect(dropdown.dropdownStyle).to.have.property('top');
|
|
245
243
|
expect(dropdown.arrowStyle).to.have.property('transform');
|
|
246
244
|
expect(dropdown.arrowStyle['transform']).to.include('rotate(180deg)');
|
|
247
|
-
// Screenshot positioned dropdown
|
|
248
|
-
await assertScreenshot('dropdown/bottom-edge-collision', getDropdownClip(dropdown));
|
|
249
245
|
}
|
|
250
246
|
finally {
|
|
251
247
|
// Restore original method
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-dropdown.test.js","sourceRoot":"","sources":["../../test/temba-dropdown.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B,+CAA+C;AAC/C,MAAM,mBAAmB,GAAG,KAAK,EAAE,QAAkB,EAAE,SAAS,GAAG,GAAG,EAAE,EAAE;IACxE,MAAM,QAAQ,CAAC,cAAc,CAAC;IAC9B,0DAA0D;IAC1D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,CAAC,cAAc,CAAC;AAChC,CAAC,CAAC;AAEF,gFAAgF;AAChF,MAAM,eAA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from '@open-wc/testing';\nimport { Dropdown } from '../src/display/Dropdown';\nimport { assertScreenshot, getClip, getComponent } from './utils.test';\n\nconst TAG = 'temba-dropdown';\n\n// Helper function to wait for stable rendering\nconst waitForStableRender = async (dropdown: Dropdown, timeoutMs = 100) => {\n await dropdown.updateComplete;\n // Double wait to ensure any async positioning is complete\n await new Promise((resolve) => setTimeout(resolve, timeoutMs));\n await dropdown.updateComplete;\n};\n\n// Helper function to get expanded clip that includes dropdown content when open\nconst getDropdownClip = (dropdown: Dropdown) => {\n if (!dropdown.open) {\n // If closed, use regular clipping\n return getClip(dropdown);\n }\n\n // For open dropdowns, include the positioned dropdown content\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const dropdownBounds = dropdownDiv.getBoundingClientRect();\n const componentBounds = dropdown.getBoundingClientRect();\n\n // If dropdown content has no meaningful size, fall back to regular clip\n if (dropdownBounds.width < 10 || dropdownBounds.height < 10) {\n return getClip(dropdown);\n }\n\n // Create a clipping region that includes both the component and the dropdown content\n const minX = Math.min(componentBounds.x, dropdownBounds.x);\n const minY = Math.min(componentBounds.y, dropdownBounds.y);\n const maxX = Math.max(componentBounds.right, dropdownBounds.right);\n const maxY = Math.max(componentBounds.bottom, dropdownBounds.bottom);\n\n // Clamp to reasonable bounds to avoid excessive screenshot sizes\n const x = Math.max(0, minX - 10);\n const y = Math.max(0, minY - 10);\n const width = Math.min(1000, maxX - minX + 20);\n const height = Math.min(800, maxY - minY + 20);\n\n return { x, y, width, height };\n};\n\nconst getDropdown = async (\n attrs: {\n open?: boolean;\n dormant?: boolean;\n arrowSize?: number;\n margin?: number;\n mask?: boolean;\n } = {},\n toggleSlot = '<button slot=\"toggle\">Toggle</button>',\n dropdownSlot = '<div slot=\"dropdown\">Dropdown content</div>'\n) => {\n const dropdown = (await getComponent(\n TAG,\n attrs,\n `${toggleSlot}${dropdownSlot}`,\n 400,\n 300\n )) as Dropdown;\n await dropdown.updateComplete;\n return dropdown;\n};\n\ndescribe(TAG, () => {\n it('can be created', async () => {\n const dropdown = await getDropdown();\n assert.instanceOf(dropdown, Dropdown);\n });\n\n it('has correct default properties', async () => {\n const dropdown = await getDropdown();\n\n // Test expected values first\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n expect(dropdown.arrowSize).to.equal(8);\n expect(dropdown.margin).to.equal(10);\n expect(dropdown.mask).to.equal(false);\n // Position calculation happens automatically, so styles won't be empty\n expect(typeof dropdown.dropdownStyle).to.equal('object');\n expect(typeof dropdown.arrowStyle).to.equal('object');\n\n // Then screenshot\n await assertScreenshot('dropdown/default', getClip(dropdown));\n });\n\n it('renders with mask when enabled', async () => {\n const dropdown = await getDropdown({ mask: true });\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Test expected values first\n expect(dropdown.mask).to.equal(true);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Then screenshot\n await assertScreenshot('dropdown/with-mask', getDropdownClip(dropdown));\n });\n\n it('handles toggle click and opens dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Verify initial state\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n\n // Click the toggle\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Verify dropdown opened\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot the opened state with expanded clip\n await assertScreenshot('dropdown/opened', getDropdownClip(dropdown));\n });\n\n it('handles custom arrow size', async () => {\n const dropdown = await getDropdown({ arrowSize: 12 });\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Test expected values first\n expect(dropdown.arrowSize).to.equal(12);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Then screenshot\n await assertScreenshot(\n 'dropdown/custom-arrow-size',\n getDropdownClip(dropdown)\n );\n });\n\n it('calculates position correctly', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await dropdown.updateComplete;\n\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position styles were calculated\n expect(Object.keys(dropdown.dropdownStyle).length).to.be.greaterThan(0);\n expect(Object.keys(dropdown.arrowStyle).length).to.be.greaterThan(0);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot positioned dropdown\n await assertScreenshot('dropdown/positioned', getDropdownClip(dropdown));\n });\n\n it('handles blur events to close dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown first\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Simulate blur event\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: document.body\n });\n dropdownDiv.dispatchEvent(blurEvent);\n\n // Check that dropdown is closed after a short delay\n await new Promise((resolve) => setTimeout(resolve, 300));\n expect(dropdown.open).to.equal(false);\n\n // Screenshot closed state\n await assertScreenshot('dropdown/after-blur', getClip(dropdown));\n });\n\n it('handles blur events when focus moves within dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown first\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Create an element within the dropdown\n const dropdownContent = dropdown.querySelector(\n '[slot=\"dropdown\"]'\n ) as HTMLElement;\n const internalButton = document.createElement('button');\n internalButton.textContent = 'Internal';\n dropdownContent.appendChild(internalButton);\n\n // Simulate blur event where focus moves to internal element\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: internalButton\n });\n dropdownDiv.dispatchEvent(blurEvent);\n await dropdown.updateComplete;\n\n // Dropdown should remain open since focus moved within it\n expect(dropdown.open).to.equal(true);\n });\n\n it('prevents opening when already open', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // First, open the dropdown normally\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Now try to click toggle again - should not call openDropdown again\n // since !dropdown.open is false\n const originalOpen = dropdown.open;\n toggle.click();\n await dropdown.updateComplete;\n\n // Should remain in the same state\n expect(dropdown.open).to.equal(originalOpen);\n });\n\n it('handles position calculation with right edge collision', async () => {\n // Create dropdown positioned near right edge\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"position: fixed; right: 50px; top: 100px; width: 100px; height: 30px;\">Toggle</button>',\n '<div slot=\"dropdown\" style=\"width: 200px; height: 100px;\">Wide content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Get actual element bounds to simulate collision\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const originalGetBoundingClientRect = dropdownDiv.getBoundingClientRect;\n\n // Mock getBoundingClientRect to simulate right collision\n dropdownDiv.getBoundingClientRect = function () {\n return {\n bottom: 200,\n right: window.innerWidth + 100, // Extends beyond window\n top: 100,\n left: window.innerWidth - 50,\n width: 200,\n height: 100,\n x: window.innerWidth - 50,\n y: 100\n } as DOMRect;\n };\n\n try {\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position was adjusted for right edge\n expect(dropdown.dropdownStyle).to.have.property('left');\n\n // Screenshot positioned dropdown\n await assertScreenshot(\n 'dropdown/right-edge-collision',\n getDropdownClip(dropdown)\n );\n } finally {\n // Restore original method\n dropdownDiv.getBoundingClientRect = originalGetBoundingClientRect;\n }\n });\n\n it('handles position calculation with bottom edge collision', async () => {\n // Create dropdown positioned near bottom edge\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"position: fixed; left: 100px; bottom: 50px; width: 100px; height: 30px;\">Toggle</button>',\n '<div slot=\"dropdown\" style=\"width: 200px; height: 100px; position: absolute;\">Tall content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Get actual element bounds to simulate collision\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const originalGetBoundingClientRect = dropdownDiv.getBoundingClientRect;\n\n // Mock getBoundingClientRect to simulate bottom collision\n dropdownDiv.getBoundingClientRect = function () {\n return {\n bottom: window.innerHeight + 100, // Extends beyond window\n right: 300,\n top: window.innerHeight - 50,\n left: 100,\n width: 200,\n height: 100,\n x: 100,\n y: window.innerHeight - 50\n } as DOMRect;\n };\n\n try {\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position was adjusted for bottom edge (bumped up)\n expect(dropdown.dropdownStyle).to.have.property('top');\n expect(dropdown.arrowStyle).to.have.property('transform');\n expect(dropdown.arrowStyle['transform']).to.include('rotate(180deg)');\n\n // Screenshot positioned dropdown\n await assertScreenshot(\n 'dropdown/bottom-edge-collision',\n getDropdownClip(dropdown)\n );\n } finally {\n // Restore original method\n dropdownDiv.getBoundingClientRect = originalGetBoundingClientRect;\n }\n });\n\n it('handles arrow positioning when toggle is very narrow', async () => {\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"width: 5px;\">•</button>',\n '<div slot=\"dropdown\">Content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await dropdown.updateComplete;\n\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify arrow positioning was adjusted for narrow toggle\n expect(dropdown.dropdownStyle).to.have.property('marginLeft');\n expect(dropdown.dropdownStyle['marginLeft']).to.equal('-10px');\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot with adjusted arrow\n await assertScreenshot('dropdown/narrow-toggle', getDropdownClip(dropdown));\n });\n\n it('handles position calculation when toggle element is missing', async () => {\n const dropdown = await getDropdown(\n { open: true, dormant: false },\n '', // No toggle element\n '<div slot=\"dropdown\">Content</div>'\n );\n\n // Trigger position calculation - should handle gracefully\n dropdown.calculatePosition();\n await dropdown.updateComplete;\n\n // Should not crash and should have basic styles\n expect(typeof dropdown.dropdownStyle).to.equal('object');\n expect(typeof dropdown.arrowStyle).to.equal('object');\n });\n\n it('handles resetBlurHandler when activeFocus exists', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open dropdown to trigger resetBlurHandler for the first time\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Now open it again - this should trigger the activeFocus cleanup branch\n // First we need to close it\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: document.body\n });\n dropdownDiv.dispatchEvent(blurEvent);\n\n // Wait for close\n await new Promise((resolve) => setTimeout(resolve, 300));\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n\n // Open again - this should trigger the cleanup in resetBlurHandler\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n });\n\n it('renders without mask by default', async () => {\n const dropdown = await getDropdown(); // No mask explicitly set\n\n // Test expected values first - mask should be false by default\n expect(dropdown.mask).to.equal(false);\n\n // Look for mask element in shadow DOM - should not exist when mask is false\n const maskElement = dropdown.shadowRoot.querySelector('.mask');\n expect(maskElement).to.be.null;\n\n // Screenshot default rendering\n await assertScreenshot('dropdown/no-mask', getClip(dropdown));\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"temba-dropdown.test.js","sourceRoot":"","sources":["../../test/temba-dropdown.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B,+CAA+C;AAC/C,MAAM,mBAAmB,GAAG,KAAK,EAAE,QAAkB,EAAE,SAAS,GAAG,GAAG,EAAE,EAAE;IACxE,MAAM,QAAQ,CAAC,cAAc,CAAC;IAC9B,0DAA0D;IAC1D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,CAAC,cAAc,CAAC;AAChC,CAAC,CAAC;AAEF,gFAAgF;AAChF,MAAM,eAAe,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC7C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnB,kCAAkC;QAClC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,8DAA8D;IAC9D,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CACnD,WAAW,CACM,CAAC;IACpB,MAAM,cAAc,GAAG,WAAW,CAAC,qBAAqB,EAAE,CAAC;IAC3D,MAAM,eAAe,GAAG,QA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AC;QACf,MAAM,QAAQ,CAAC,cAAc,CAAC;QAC9B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC,CAAC,yBAAyB;QAE/D,+DAA+D;QAC/D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEtC,4EAA4E;QAC5E,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC/D,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAE/B,+BAA+B;QAC/B,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { assert, expect } from '@open-wc/testing';\nimport { Dropdown } from '../src/display/Dropdown';\nimport { assertScreenshot, getClip, getComponent } from './utils.test';\n\nconst TAG = 'temba-dropdown';\n\n// Helper function to wait for stable rendering\nconst waitForStableRender = async (dropdown: Dropdown, timeoutMs = 100) => {\n await dropdown.updateComplete;\n // Double wait to ensure any async positioning is complete\n await new Promise((resolve) => setTimeout(resolve, timeoutMs));\n await dropdown.updateComplete;\n};\n\n// Helper function to get expanded clip that includes dropdown content when open\nconst getDropdownClip = (dropdown: Dropdown) => {\n if (!dropdown.open) {\n // If closed, use regular clipping\n return getClip(dropdown);\n }\n\n // For open dropdowns, include the positioned dropdown content\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const dropdownBounds = dropdownDiv.getBoundingClientRect();\n const componentBounds = dropdown.getBoundingClientRect();\n\n // If dropdown content has no meaningful size, fall back to regular clip\n if (dropdownBounds.width < 10 || dropdownBounds.height < 10) {\n return getClip(dropdown);\n }\n\n // Create a clipping region that includes both the component and the dropdown content\n const minX = Math.min(componentBounds.x, dropdownBounds.x);\n const minY = Math.min(componentBounds.y, dropdownBounds.y);\n const maxX = Math.max(componentBounds.right, dropdownBounds.right);\n const maxY = Math.max(componentBounds.bottom, dropdownBounds.bottom);\n\n // Clamp to reasonable bounds to avoid excessive screenshot sizes\n const x = Math.max(0, minX - 10);\n const y = Math.max(0, minY - 10);\n const width = Math.min(1000, maxX - minX + 20);\n const height = Math.min(800, maxY - minY + 20);\n\n return { x, y, width, height };\n};\n\nconst getDropdown = async (\n attrs: {\n open?: boolean;\n dormant?: boolean;\n arrowSize?: number;\n margin?: number;\n mask?: boolean;\n } = {},\n toggleSlot = '<button slot=\"toggle\">Toggle</button>',\n dropdownSlot = '<div slot=\"dropdown\">Dropdown content</div>'\n) => {\n const dropdown = (await getComponent(\n TAG,\n attrs,\n `${toggleSlot}${dropdownSlot}`,\n 400,\n 300\n )) as Dropdown;\n await dropdown.updateComplete;\n return dropdown;\n};\n\ndescribe(TAG, () => {\n it('can be created', async () => {\n const dropdown = await getDropdown();\n assert.instanceOf(dropdown, Dropdown);\n });\n\n it('has correct default properties', async () => {\n const dropdown = await getDropdown();\n\n // Test expected values first\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n expect(dropdown.arrowSize).to.equal(8);\n expect(dropdown.margin).to.equal(10);\n expect(dropdown.mask).to.equal(false);\n // Position calculation happens automatically, so styles won't be empty\n expect(typeof dropdown.dropdownStyle).to.equal('object');\n expect(typeof dropdown.arrowStyle).to.equal('object');\n\n // Then screenshot\n await assertScreenshot('dropdown/default', getClip(dropdown));\n });\n\n it('renders with mask when enabled', async () => {\n const dropdown = await getDropdown({ mask: true });\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Test expected values first\n expect(dropdown.mask).to.equal(true);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Then screenshot\n await assertScreenshot('dropdown/with-mask', getDropdownClip(dropdown));\n });\n\n it('handles toggle click and opens dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Verify initial state\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n\n // Click the toggle\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Verify dropdown opened\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot the opened state with expanded clip\n await assertScreenshot('dropdown/opened', getDropdownClip(dropdown));\n });\n\n it('handles custom arrow size', async () => {\n const dropdown = await getDropdown({ arrowSize: 12 });\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Test expected values first\n expect(dropdown.arrowSize).to.equal(12);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Then screenshot\n await assertScreenshot(\n 'dropdown/custom-arrow-size',\n getDropdownClip(dropdown)\n );\n });\n\n it('calculates position correctly', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await dropdown.updateComplete;\n\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position styles were calculated\n expect(Object.keys(dropdown.dropdownStyle).length).to.be.greaterThan(0);\n expect(Object.keys(dropdown.arrowStyle).length).to.be.greaterThan(0);\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot positioned dropdown\n await assertScreenshot('dropdown/positioned', getDropdownClip(dropdown));\n });\n\n it('handles blur events to close dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown first\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Simulate blur event\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: document.body\n });\n dropdownDiv.dispatchEvent(blurEvent);\n\n // Check that dropdown is closed after a short delay\n await new Promise((resolve) => setTimeout(resolve, 300));\n expect(dropdown.open).to.equal(false);\n\n // Screenshot closed state\n await assertScreenshot('dropdown/after-blur', getClip(dropdown));\n });\n\n it('handles blur events when focus moves within dropdown', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown first\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Create an element within the dropdown\n const dropdownContent = dropdown.querySelector(\n '[slot=\"dropdown\"]'\n ) as HTMLElement;\n const internalButton = document.createElement('button');\n internalButton.textContent = 'Internal';\n dropdownContent.appendChild(internalButton);\n\n // Simulate blur event where focus moves to internal element\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: internalButton\n });\n dropdownDiv.dispatchEvent(blurEvent);\n await dropdown.updateComplete;\n\n // Dropdown should remain open since focus moved within it\n expect(dropdown.open).to.equal(true);\n });\n\n it('prevents opening when already open', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // First, open the dropdown normally\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Now try to click toggle again - should not call openDropdown again\n // since !dropdown.open is false\n const originalOpen = dropdown.open;\n toggle.click();\n await dropdown.updateComplete;\n\n // Should remain in the same state\n expect(dropdown.open).to.equal(originalOpen);\n });\n\n it('handles position calculation with right edge collision', async () => {\n // Create dropdown positioned near right edge\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"position: fixed; right: 50px; top: 100px; width: 100px; height: 30px;\">Toggle</button>',\n '<div slot=\"dropdown\" style=\"width: 200px; height: 100px;\">Wide content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Get actual element bounds to simulate collision\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const originalGetBoundingClientRect = dropdownDiv.getBoundingClientRect;\n\n // Mock getBoundingClientRect to simulate right collision\n dropdownDiv.getBoundingClientRect = function () {\n return {\n bottom: 200,\n right: window.innerWidth + 100, // Extends beyond window\n top: 100,\n left: window.innerWidth - 50,\n width: 200,\n height: 100,\n x: window.innerWidth - 50,\n y: 100\n } as DOMRect;\n };\n\n try {\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position was adjusted for right edge\n expect(dropdown.dropdownStyle).to.have.property('left');\n } finally {\n // Restore original method\n dropdownDiv.getBoundingClientRect = originalGetBoundingClientRect;\n }\n });\n\n it('handles position calculation with bottom edge collision', async () => {\n // Create dropdown positioned near bottom edge\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"position: fixed; left: 100px; bottom: 50px; width: 100px; height: 30px;\">Toggle</button>',\n '<div slot=\"dropdown\" style=\"width: 200px; height: 100px; position: absolute;\">Tall content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await waitForStableRender(dropdown);\n\n // Get actual element bounds to simulate collision\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const originalGetBoundingClientRect = dropdownDiv.getBoundingClientRect;\n\n // Mock getBoundingClientRect to simulate bottom collision\n dropdownDiv.getBoundingClientRect = function () {\n return {\n bottom: window.innerHeight + 100, // Extends beyond window\n right: 300,\n top: window.innerHeight - 50,\n left: 100,\n width: 200,\n height: 100,\n x: 100,\n y: window.innerHeight - 50\n } as DOMRect;\n };\n\n try {\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify position was adjusted for bottom edge (bumped up)\n expect(dropdown.dropdownStyle).to.have.property('top');\n expect(dropdown.arrowStyle).to.have.property('transform');\n expect(dropdown.arrowStyle['transform']).to.include('rotate(180deg)');\n } finally {\n // Restore original method\n dropdownDiv.getBoundingClientRect = originalGetBoundingClientRect;\n }\n });\n\n it('handles arrow positioning when toggle is very narrow', async () => {\n const dropdown = await getDropdown(\n {},\n '<button slot=\"toggle\" style=\"width: 5px;\">•</button>',\n '<div slot=\"dropdown\">Content</div>'\n );\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open the dropdown properly by clicking\n toggle.click();\n await dropdown.updateComplete;\n\n // Trigger position calculation\n dropdown.calculatePosition();\n await waitForStableRender(dropdown);\n\n // Verify arrow positioning was adjusted for narrow toggle\n expect(dropdown.dropdownStyle).to.have.property('marginLeft');\n expect(dropdown.dropdownStyle['marginLeft']).to.equal('-10px');\n expect(dropdown.open).to.equal(true);\n expect(dropdown.dormant).to.equal(false);\n\n // Screenshot with adjusted arrow\n await assertScreenshot('dropdown/narrow-toggle', getDropdownClip(dropdown));\n });\n\n it('handles position calculation when toggle element is missing', async () => {\n const dropdown = await getDropdown(\n { open: true, dormant: false },\n '', // No toggle element\n '<div slot=\"dropdown\">Content</div>'\n );\n\n // Trigger position calculation - should handle gracefully\n dropdown.calculatePosition();\n await dropdown.updateComplete;\n\n // Should not crash and should have basic styles\n expect(typeof dropdown.dropdownStyle).to.equal('object');\n expect(typeof dropdown.arrowStyle).to.equal('object');\n });\n\n it('handles resetBlurHandler when activeFocus exists', async () => {\n const dropdown = await getDropdown();\n const toggle = dropdown.querySelector('[slot=\"toggle\"]') as HTMLElement;\n\n // Open dropdown to trigger resetBlurHandler for the first time\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n\n // Now open it again - this should trigger the activeFocus cleanup branch\n // First we need to close it\n const dropdownDiv = dropdown.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const blurEvent = new FocusEvent('blur', {\n bubbles: true,\n relatedTarget: document.body\n });\n dropdownDiv.dispatchEvent(blurEvent);\n\n // Wait for close\n await new Promise((resolve) => setTimeout(resolve, 300));\n expect(dropdown.open).to.equal(false);\n expect(dropdown.dormant).to.equal(true);\n\n // Open again - this should trigger the cleanup in resetBlurHandler\n toggle.click();\n await dropdown.updateComplete;\n expect(dropdown.open).to.equal(true);\n });\n\n it('renders without mask by default', async () => {\n const dropdown = await getDropdown(); // No mask explicitly set\n\n // Test expected values first - mask should be false by default\n expect(dropdown.mask).to.equal(false);\n\n // Look for mask element in shadow DOM - should not exist when mask is false\n const maskElement = dropdown.shadowRoot.querySelector('.mask');\n expect(maskElement).to.be.null;\n\n // Screenshot default rendering\n await assertScreenshot('dropdown/no-mask', getClip(dropdown));\n });\n});\n"]}
|
|
@@ -179,11 +179,16 @@ describe('EditorNode', () => {
|
|
|
179
179
|
name: 'Test Action',
|
|
180
180
|
color: '#ff0000'
|
|
181
181
|
};
|
|
182
|
-
const
|
|
182
|
+
const mockAction = {
|
|
183
|
+
type: 'send_msg',
|
|
184
|
+
uuid: 'test-action'
|
|
185
|
+
};
|
|
186
|
+
const result = editorNode.renderTitle(config, mockAction, 0);
|
|
183
187
|
const container = await fixture(html `<div>${result}</div>`);
|
|
184
|
-
const title = container.querySelector('.title');
|
|
188
|
+
const title = container.querySelector('.cn-title');
|
|
185
189
|
expect(title).to.exist;
|
|
186
|
-
|
|
190
|
+
const nameElement = title === null || title === void 0 ? void 0 : title.querySelector('.name');
|
|
191
|
+
expect((_a = nameElement === null || nameElement === void 0 ? void 0 : nameElement.textContent) === null || _a === void 0 ? void 0 : _a.trim()).to.equal('Test Action');
|
|
187
192
|
expect(title === null || title === void 0 ? void 0 : title.getAttribute('style')).to.contain('background:#ff0000');
|
|
188
193
|
});
|
|
189
194
|
});
|
|
@@ -810,7 +815,7 @@ describe('EditorNode', () => {
|
|
|
810
815
|
expect(actionElement).to.exist;
|
|
811
816
|
expect(actionElement === null || actionElement === void 0 ? void 0 : actionElement.classList.contains('removing')).to.be.true;
|
|
812
817
|
// Check that title shows "Remove?"
|
|
813
|
-
const titleElement = container.querySelector('.title .name');
|
|
818
|
+
const titleElement = container.querySelector('.cn-title .name');
|
|
814
819
|
expect((_a = titleElement === null || titleElement === void 0 ? void 0 : titleElement.textContent) === null || _a === void 0 ? void 0 : _a.trim()).to.equal('Remove?');
|
|
815
820
|
});
|
|
816
821
|
it('handles multiple action removal states independently', async () => {
|