@imposium-hub/components 2.14.11 → 2.15.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/app-wrapper/AppWrapper.d.ts +1 -6
- package/dist/cjs/components/app-wrapper/AppWrapper.js +4 -8
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapperV2.d.ts +26 -0
- package/dist/cjs/components/app-wrapper/AppWrapperV2.js +266 -0
- package/dist/cjs/components/app-wrapper/AppWrapperV2.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapperV3.d.ts +19 -0
- package/dist/cjs/components/app-wrapper/AppWrapperV3.js +195 -0
- package/dist/cjs/components/app-wrapper/AppWrapperV3.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js +255 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js +251 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/cjs/components/assets/AssetsUploadMenu.js +5 -5
- package/dist/cjs/components/auth-gate/AuthGate.d.ts +2 -0
- package/dist/cjs/components/auth-gate/AuthGate.js +105 -0
- package/dist/cjs/components/auth-gate/AuthGate.js.map +1 -0
- package/dist/cjs/components/change-report/ChangeReportTree.d.ts +10 -0
- package/dist/cjs/components/change-report/ChangeReportTree.js +95 -0
- package/dist/cjs/components/change-report/ChangeReportTree.js.map +1 -0
- package/dist/cjs/components/context-menu/AnimateComponent.d.ts +0 -1
- package/dist/cjs/components/context-menu/AnimateComponent.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenu.d.ts +0 -1
- package/dist/cjs/components/context-menu/ContextMenu.js +6 -6
- package/dist/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenuItem.d.ts +0 -1
- package/dist/cjs/components/context-menu/ContextMenuItem.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenuTrigger.d.ts +0 -1
- package/dist/cjs/components/context-menu/ContextMenuTrigger.js.map +1 -1
- package/dist/cjs/components/context-menu/SubMenu.d.ts +0 -1
- package/dist/cjs/components/context-menu/SubMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/{Dropdown.stories.js → dropdown.stories.js} +1 -1
- package/dist/cjs/components/dropdown/{Dropdown.stories.js.map → dropdown.stories.js.map} +1 -1
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.d.ts +8 -0
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.js +132 -0
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.js.map +1 -0
- package/dist/cjs/components/edit-marker-modal/EditMarkerModal.d.ts +8 -0
- package/dist/cjs/components/edit-marker-modal/EditMarkerModal.js +104 -0
- package/dist/cjs/components/edit-marker-modal/EditMarkerModal.js.map +1 -0
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js +91 -0
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
- package/dist/cjs/components/feature-flag-wrapper/FeatureFlagWrapper.d.ts +7 -0
- package/dist/cjs/components/feature-flag-wrapper/FeatureFlagWrapper.js +48 -0
- package/dist/cjs/components/feature-flag-wrapper/FeatureFlagWrapper.js.map +1 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js +393 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/cjs/components/header/Header_BASE_73021.js +376 -0
- package/dist/cjs/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js +382 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js +386 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/cjs/components/header/StoryDropdown.d.ts +6 -0
- package/dist/cjs/components/header/StoryDropdown.js +111 -0
- package/dist/cjs/components/header/StoryDropdown.js.map +1 -0
- package/dist/cjs/components/number-field/NumberField.d.ts +2 -3
- package/dist/cjs/components/number-field/NumberField.js +19 -23
- package/dist/cjs/components/number-field/NumberField.js.map +1 -1
- package/dist/cjs/components/portal/Portal.d.ts +0 -1
- package/dist/cjs/components/portal/Portal.js.map +1 -1
- package/dist/cjs/components/publish-wizard/PublishWizard.d.ts +5 -4
- package/dist/cjs/components/publish-wizard/PublishWizard.js +104 -38
- package/dist/cjs/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.d.ts +11 -0
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.js +213 -0
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.js.map +1 -0
- package/dist/cjs/components/service-icon/ServiceIcon.test.d.ts +0 -0
- package/dist/cjs/components/service-icon/ServiceIcon.test.js +1 -0
- package/dist/cjs/components/service-icon/ServiceIcon.test.js.map +1 -0
- package/dist/cjs/components/story-previewer/StoryPreviewer.js +2 -15
- package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.d.ts +4 -12
- package/dist/cjs/components/tabs/Tabs.js +3 -21
- package/dist/cjs/components/tabs/Tabs.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.stories.d.ts +3 -1
- package/dist/cjs/components/tag/Tag.test.d.ts +0 -0
- package/dist/cjs/components/tag/Tag.test.js +1 -0
- package/dist/cjs/components/tag/Tag.test.js.map +1 -0
- package/dist/cjs/constants/copy.d.ts +9 -0
- package/dist/cjs/constants/copy.js +13 -2
- package/dist/cjs/constants/copy.js.map +1 -1
- package/dist/cjs/constants/snippets.d.ts +18 -0
- package/dist/cjs/constants/snippets.js +3 -0
- package/dist/cjs/constants/snippets.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +4 -36
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/redux/actions/auth.d.ts +9 -0
- package/dist/cjs/redux/actions/auth.js +30 -0
- package/dist/cjs/redux/actions/auth.js.map +1 -0
- package/dist/cjs/redux/reducers/auth.d.ts +3 -0
- package/dist/cjs/redux/reducers/auth.js +67 -0
- package/dist/cjs/redux/reducers/auth.js.map +1 -0
- package/dist/cjs/services/API.d.ts +2 -0
- package/dist/cjs/services/API.js +6 -0
- package/dist/cjs/services/API.js.map +1 -1
- package/dist/cjs/services/Auth0.d.ts +18 -0
- package/dist/cjs/services/Auth0.js +102 -0
- package/dist/cjs/services/Auth0.js.map +1 -0
- package/dist/cjs/services/Session.d.ts +26 -0
- package/dist/cjs/services/Session.js +155 -0
- package/dist/cjs/services/Session.js.map +1 -0
- package/dist/cjs/utils/routing.d.ts +2 -4
- package/dist/cjs/utils/routing.js +4 -8
- package/dist/cjs/utils/routing.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper.d.ts +1 -6
- package/dist/esm/components/app-wrapper/AppWrapper.js +5 -9
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapperV2.d.ts +26 -0
- package/dist/esm/components/app-wrapper/AppWrapperV2.js +142 -0
- package/dist/esm/components/app-wrapper/AppWrapperV2.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapperV3.d.ts +19 -0
- package/dist/esm/components/app-wrapper/AppWrapperV3.js +88 -0
- package/dist/esm/components/app-wrapper/AppWrapperV3.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js +208 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js +204 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/esm/components/assets/AssetsUploadMenu.js +5 -5
- package/dist/esm/components/auth-gate/AuthGate.d.ts +2 -0
- package/dist/esm/components/auth-gate/AuthGate.js +59 -0
- package/dist/esm/components/auth-gate/AuthGate.js.map +1 -0
- package/dist/esm/components/change-report/ChangeReportTree.d.ts +10 -0
- package/dist/esm/components/change-report/ChangeReportTree.js +42 -0
- package/dist/esm/components/change-report/ChangeReportTree.js.map +1 -0
- package/dist/esm/components/context-menu/AnimateComponent.d.ts +0 -1
- package/dist/esm/components/context-menu/AnimateComponent.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenu.d.ts +0 -1
- package/dist/esm/components/context-menu/ContextMenu.js +1 -2
- package/dist/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenuItem.d.ts +0 -1
- package/dist/esm/components/context-menu/ContextMenuItem.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenuTrigger.d.ts +0 -1
- package/dist/esm/components/context-menu/ContextMenuTrigger.js.map +1 -1
- package/dist/esm/components/context-menu/SubMenu.d.ts +0 -1
- package/dist/esm/components/context-menu/SubMenu.js.map +1 -1
- package/dist/esm/components/dropdown/{Dropdown.stories.js → dropdown.stories.js} +1 -1
- package/dist/esm/components/dropdown/{Dropdown.stories.js.map → dropdown.stories.js.map} +1 -1
- package/dist/esm/components/edit-guide-modal/EditGuideModal.d.ts +8 -0
- package/dist/esm/components/edit-guide-modal/EditGuideModal.js +65 -0
- package/dist/esm/components/edit-guide-modal/EditGuideModal.js.map +1 -0
- package/dist/esm/components/edit-marker-modal/EditMarkerModal.d.ts +8 -0
- package/dist/esm/components/edit-marker-modal/EditMarkerModal.js +72 -0
- package/dist/esm/components/edit-marker-modal/EditMarkerModal.js.map +1 -0
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.js +35 -0
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
- package/dist/esm/components/feature-flag-wrapper/FeatureFlagWrapper.d.ts +7 -0
- package/dist/esm/components/feature-flag-wrapper/FeatureFlagWrapper.js +10 -0
- package/dist/esm/components/feature-flag-wrapper/FeatureFlagWrapper.js.map +1 -0
- package/dist/esm/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js +336 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/esm/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/esm/components/header/Header_BASE_73021.js +322 -0
- package/dist/esm/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/esm/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js +328 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/esm/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js +329 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/esm/components/header/StoryDropdown.d.ts +6 -0
- package/dist/esm/components/header/StoryDropdown.js +82 -0
- package/dist/esm/components/header/StoryDropdown.js.map +1 -0
- package/dist/esm/components/number-field/NumberField.d.ts +2 -3
- package/dist/esm/components/number-field/NumberField.js +19 -18
- package/dist/esm/components/number-field/NumberField.js.map +1 -1
- package/dist/esm/components/portal/Portal.d.ts +0 -1
- package/dist/esm/components/portal/Portal.js.map +1 -1
- package/dist/esm/components/publish-wizard/PublishWizard.d.ts +5 -4
- package/dist/esm/components/publish-wizard/PublishWizard.js +92 -38
- package/dist/esm/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.d.ts +11 -0
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.js +141 -0
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.js.map +1 -0
- package/dist/esm/components/service-icon/ServiceIcon.test.d.ts +0 -0
- package/dist/esm/components/service-icon/ServiceIcon.test.js +1 -0
- package/dist/esm/components/service-icon/ServiceIcon.test.js.map +1 -0
- package/dist/esm/components/story-previewer/StoryPreviewer.js +2 -14
- package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.d.ts +4 -12
- package/dist/esm/components/tabs/Tabs.js +4 -11
- package/dist/esm/components/tabs/Tabs.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.stories.d.ts +3 -1
- package/dist/esm/components/tag/Tag.test.d.ts +0 -0
- package/dist/esm/components/tag/Tag.test.js +1 -0
- package/dist/esm/components/tag/Tag.test.js.map +1 -0
- package/dist/esm/constants/copy.d.ts +9 -0
- package/dist/esm/constants/copy.js +13 -2
- package/dist/esm/constants/copy.js.map +1 -1
- package/dist/esm/constants/snippets.d.ts +18 -0
- package/dist/esm/constants/snippets.js +2 -0
- package/dist/esm/constants/snippets.js.map +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/redux/actions/auth.d.ts +9 -0
- package/dist/esm/redux/actions/auth.js +25 -0
- package/dist/esm/redux/actions/auth.js.map +1 -0
- package/dist/esm/redux/reducers/auth.d.ts +3 -0
- package/dist/esm/redux/reducers/auth.js +27 -0
- package/dist/esm/redux/reducers/auth.js.map +1 -0
- package/dist/esm/services/API.d.ts +2 -0
- package/dist/esm/services/API.js +6 -0
- package/dist/esm/services/API.js.map +1 -1
- package/dist/esm/services/Auth0.d.ts +18 -0
- package/dist/esm/services/Auth0.js +68 -0
- package/dist/esm/services/Auth0.js.map +1 -0
- package/dist/esm/services/Session.d.ts +26 -0
- package/dist/esm/services/Session.js +107 -0
- package/dist/esm/services/Session.js.map +1 -0
- package/dist/esm/utils/routing.d.ts +2 -4
- package/dist/esm/utils/routing.js +3 -6
- package/dist/esm/utils/routing.js.map +1 -1
- package/dist/styles.css +130 -3
- package/dist/styles.less +215 -64
- package/less/components/assets.less +5 -6
- package/less/components/auth-gate.less +1 -1
- package/less/components/change-report.less +115 -0
- package/less/components/data-table.less +2 -2
- package/less/components/determinate-loader.less +2 -2
- package/less/components/font-preview.less +1 -1
- package/less/components/form-field.less +5 -5
- package/less/components/header.less +30 -30
- package/less/components/modal.less +2 -2
- package/less/components/player.less +2 -2
- package/less/components/publish-wizard.less +36 -0
- package/less/components/section.less +2 -2
- package/less/components/static-composition-editor.less +4 -4
- package/less/components/story-previewer.less +4 -4
- package/less/components/tabs.less +3 -3
- package/less/entry.less +1 -0
- package/package.json +13 -24
- package/src/components/app-wrapper/AppWrapper.tsx +10 -18
- package/src/components/assets/AssetsUploadMenu.tsx +5 -5
- package/src/components/change-report/ChangeReportTree.tsx +125 -0
- package/src/components/context-menu/AnimateComponent.tsx +0 -1
- package/src/components/context-menu/ContextMenu.tsx +13 -15
- package/src/components/context-menu/ContextMenuItem.tsx +0 -1
- package/src/components/context-menu/ContextMenuTrigger.tsx +0 -1
- package/src/components/context-menu/SubMenu.tsx +0 -1
- package/src/components/number-field/NumberField.tsx +24 -33
- package/src/components/portal/Portal.tsx +0 -1
- package/src/components/publish-wizard/PublishWizard.tsx +145 -46
- package/src/components/service-icon/ServiceIcon.test.tsx +0 -0
- package/src/components/story-previewer/StoryPreviewer.tsx +8 -21
- package/src/components/tabs/Tabs.tsx +8 -25
- package/src/components/tag/Tag.test.tsx +0 -0
- package/src/constants/copy.ts +16 -2
- package/src/constants/snippets.ts +25 -0
- package/src/index.ts +7 -2
- package/src/services/API.ts +8 -0
- package/src/utils/routing.ts +6 -10
- package/tsconfig.json +1 -1
- package/src/components/advanced-number-field/AdvancedNumberField.test.tsx +0 -724
- package/src/components/anchor-field/AnchorField.test.tsx +0 -130
- package/src/components/asset-details/AssetDetails.test.tsx +0 -494
- package/src/components/assets/AssetField.test.tsx +0 -449
- package/src/components/assets/AssetsTableAssetIdCell.test.tsx +0 -142
- package/src/components/assets/AssetsTableAssetIdFilter.test.tsx +0 -95
- package/src/components/assets/AssetsTableComplexTagCell.test.tsx +0 -161
- package/src/components/assets/AssetsTableDateCell.test.tsx +0 -106
- package/src/components/assets/AssetsTableDropzone.test.tsx +0 -132
- package/src/components/assets/AssetsTableDurationCell.test.tsx +0 -119
- package/src/components/assets/AssetsTableGlobalCell.test.tsx +0 -46
- package/src/components/assets/AssetsTableNameCell.test.tsx +0 -166
- package/src/components/assets/AssetsTableNameFilter.test.tsx +0 -95
- package/src/components/assets/AssetsTablePreviewCell.test.tsx +0 -191
- package/src/components/assets/AssetsTableRateCell.test.tsx +0 -87
- package/src/components/assets/AssetsTableSelectCell.test.tsx +0 -156
- package/src/components/assets/AssetsTableSelectFilter.test.tsx +0 -119
- package/src/components/assets/AssetsTableStatusCell.test.tsx +0 -60
- package/src/components/number-field/NumberField.test.tsx +0 -383
- package/src/components/text-field/TextField.test.tsx +0 -988
- package/src/test/setup.ts +0 -91
- package/src/test/utils.tsx +0 -44
- package/tsconfig.eslint.json +0 -8
- package/vitest.config.ts +0 -31
- /package/dist/cjs/components/dropdown/{Dropdown.stories.d.ts → dropdown.stories.d.ts} +0 -0
- /package/dist/esm/components/dropdown/{Dropdown.stories.d.ts → dropdown.stories.d.ts} +0 -0
- /package/src/components/dropdown/{Dropdown.stories.tsx → dropdown.stories.tsx} +0 -0
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import { Provider } from 'react-redux';
|
|
5
|
-
import { legacy_createStore as createStore } from 'redux';
|
|
6
|
-
|
|
7
|
-
let capturedDoSubmit: (value: string) => void;
|
|
8
|
-
let capturedRemoveHandlers: Record<string, () => void> = {};
|
|
9
|
-
|
|
10
|
-
vi.mock('../tag/Tag', () => ({
|
|
11
|
-
default: ({ copy, removeHandler }: any) => {
|
|
12
|
-
capturedRemoveHandlers[copy] = removeHandler;
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
data-testid={`tag-${copy}`}
|
|
16
|
-
className='mock-tag'>
|
|
17
|
-
<span>{copy}</span>
|
|
18
|
-
<button
|
|
19
|
-
data-testid={`remove-${copy}`}
|
|
20
|
-
onClick={removeHandler}>
|
|
21
|
-
x
|
|
22
|
-
</button>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
vi.mock('../text-field/TextField', () => ({
|
|
29
|
-
default: ({ submittable, submittableType, placeholder, value, doSubmit, suggestions }: any) => {
|
|
30
|
-
capturedDoSubmit = doSubmit;
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
data-testid='mock-text-field'
|
|
34
|
-
data-submittable={submittable}
|
|
35
|
-
data-submittable-type={submittableType}
|
|
36
|
-
data-placeholder={placeholder}
|
|
37
|
-
data-value={value}
|
|
38
|
-
data-suggestions={JSON.stringify(suggestions || [])}>
|
|
39
|
-
<button
|
|
40
|
-
data-testid='submit-trigger'
|
|
41
|
-
onClick={() => doSubmit('new-tag')}>
|
|
42
|
-
Add
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
vi.mock('../../redux/actions/asset-list', () => ({
|
|
50
|
-
addAssetTag: vi.fn((_api, _id, _tags) => ({ type: 'MOCK_ADD_TAG' })),
|
|
51
|
-
deleteAssetTag: vi.fn((_api, _id, _tag) => ({ type: 'MOCK_DELETE_TAG' })),
|
|
52
|
-
default: {}
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
import AssetsTableComplexTagCellMemoized from './AssetsTableComplexTagCell';
|
|
56
|
-
import { addAssetTag, deleteAssetTag } from '../../redux/actions/asset-list';
|
|
57
|
-
|
|
58
|
-
const MOCK_ASSET_ID = 'asset-999';
|
|
59
|
-
const MOCK_API = { addAssetTag: vi.fn(), deleteAssetTag: vi.fn() };
|
|
60
|
-
const MOCK_SUGGESTIONS = ['alpha', 'beta', 'gamma'];
|
|
61
|
-
|
|
62
|
-
const createMockStore = (assetTags: string[] = MOCK_SUGGESTIONS) => {
|
|
63
|
-
const initialState = { assetTags };
|
|
64
|
-
return createStore((state = initialState) => state);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const buildCellProp = (tags: string[] = ['tag-a', 'tag-b']) => ({
|
|
68
|
-
row: {
|
|
69
|
-
original: { id: MOCK_ASSET_ID, tags }
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const renderComponent = (tagOverrides?: string[], storeOverrides?: string[]) => {
|
|
74
|
-
capturedRemoveHandlers = {};
|
|
75
|
-
const store = createMockStore(storeOverrides);
|
|
76
|
-
const cell = buildCellProp(tagOverrides);
|
|
77
|
-
|
|
78
|
-
const result = render(
|
|
79
|
-
<Provider store={store}>
|
|
80
|
-
<AssetsTableComplexTagCellMemoized
|
|
81
|
-
cell={cell}
|
|
82
|
-
api={MOCK_API}
|
|
83
|
-
/>
|
|
84
|
-
</Provider>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
return { ...result, store };
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
describe('AssetsTableComplexTagCell', () => {
|
|
91
|
-
it('renders existing tags as Tag components', () => {
|
|
92
|
-
const tags = ['tag-a', 'tag-b', 'tag-c'];
|
|
93
|
-
const { getByTestId } = renderComponent(tags);
|
|
94
|
-
|
|
95
|
-
tags.forEach((tag) => {
|
|
96
|
-
expect(getByTestId(`tag-${tag}`)).toBeTruthy();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('deduplicates tags before rendering', () => {
|
|
101
|
-
const { container } = renderComponent(['dup', 'dup', 'unique']);
|
|
102
|
-
const renderedTags = container.querySelectorAll('.mock-tag');
|
|
103
|
-
|
|
104
|
-
expect(renderedTags).toHaveLength(2);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('renders the TextField with correct props', () => {
|
|
108
|
-
const { getByTestId } = renderComponent();
|
|
109
|
-
const textField = getByTestId('mock-text-field');
|
|
110
|
-
|
|
111
|
-
expect(textField.getAttribute('data-submittable')).toBe('true');
|
|
112
|
-
expect(textField.getAttribute('data-submittable-type')).toBe('add');
|
|
113
|
-
expect(textField.getAttribute('data-placeholder')).toBe('+');
|
|
114
|
-
expect(textField.getAttribute('data-value')).toBe('');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('passes assetTags from store as suggestions', () => {
|
|
118
|
-
const suggestions = ['x', 'y', 'z'];
|
|
119
|
-
const { getByTestId } = renderComponent([], suggestions);
|
|
120
|
-
const textField = getByTestId('mock-text-field');
|
|
121
|
-
|
|
122
|
-
const suggestionsAttr = textField.getAttribute('data-suggestions');
|
|
123
|
-
if (suggestionsAttr) {
|
|
124
|
-
expect(suggestionsAttr).toBeTruthy();
|
|
125
|
-
expect(JSON.parse(suggestionsAttr)).toEqual(suggestions);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('dispatches addAssetTag when submitting a new tag', () => {
|
|
130
|
-
renderComponent(['existing']);
|
|
131
|
-
|
|
132
|
-
capturedDoSubmit('brand-new');
|
|
133
|
-
|
|
134
|
-
expect(addAssetTag).toHaveBeenCalledWith(MOCK_API, MOCK_ASSET_ID, 'brand-new');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('does not dispatch addAssetTag when submitting a duplicate tag', () => {
|
|
138
|
-
vi.mocked(addAssetTag).mockClear();
|
|
139
|
-
renderComponent(['already-here']);
|
|
140
|
-
|
|
141
|
-
capturedDoSubmit('already-here');
|
|
142
|
-
|
|
143
|
-
expect(addAssetTag).not.toHaveBeenCalled();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('dispatches deleteAssetTag when removing a tag', () => {
|
|
147
|
-
renderComponent(['removable']);
|
|
148
|
-
|
|
149
|
-
capturedRemoveHandlers['removable']();
|
|
150
|
-
|
|
151
|
-
expect(deleteAssetTag).toHaveBeenCalledWith(MOCK_API, MOCK_ASSET_ID, 'removable');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('renders with no tags', () => {
|
|
155
|
-
const { container, getByTestId } = renderComponent([]);
|
|
156
|
-
const renderedTags = container.querySelectorAll('.mock-tag');
|
|
157
|
-
|
|
158
|
-
expect(renderedTags).toHaveLength(0);
|
|
159
|
-
expect(getByTestId('mock-text-field')).toBeTruthy();
|
|
160
|
-
});
|
|
161
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
|
|
5
|
-
const MOCK_FORMATTED_DATE = '4/9/2026 3:00 PM';
|
|
6
|
-
|
|
7
|
-
vi.mock('../../Util', async (importOriginal) => {
|
|
8
|
-
const actual = (await importOriginal()) as any;
|
|
9
|
-
return {
|
|
10
|
-
...actual,
|
|
11
|
-
formatDateDefault: vi.fn(() => MOCK_FORMATTED_DATE)
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
import AssetsTableDateCellMemoized from './AssetsTableDateCell';
|
|
16
|
-
import { formatDateDefault } from '../../Util';
|
|
17
|
-
|
|
18
|
-
const MOCK_UNIX_TIMESTAMP = 1776013200;
|
|
19
|
-
|
|
20
|
-
const buildCellProp = (values: Record<string, any>) => ({
|
|
21
|
-
row: { values }
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('AssetsTableDateCell', () => {
|
|
25
|
-
it('renders date_created when date_created prop is true and value exists', () => {
|
|
26
|
-
const cell = buildCellProp({ date_created: MOCK_UNIX_TIMESTAMP });
|
|
27
|
-
const { container } = render(
|
|
28
|
-
<AssetsTableDateCellMemoized
|
|
29
|
-
cell={cell}
|
|
30
|
-
date_created={true}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
expect(formatDateDefault).toHaveBeenCalledWith(MOCK_UNIX_TIMESTAMP);
|
|
35
|
-
expect(container.textContent).toBe(MOCK_FORMATTED_DATE);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('renders date_modified when date_created is false', () => {
|
|
39
|
-
const cell = buildCellProp({ date_modified: MOCK_UNIX_TIMESTAMP });
|
|
40
|
-
const { container } = render(
|
|
41
|
-
<AssetsTableDateCellMemoized
|
|
42
|
-
cell={cell}
|
|
43
|
-
date_created={false}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
expect(formatDateDefault).toHaveBeenCalledWith(MOCK_UNIX_TIMESTAMP);
|
|
48
|
-
expect(container.textContent).toBe(MOCK_FORMATTED_DATE);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('falls through to date_updated when date_modified is absent', () => {
|
|
52
|
-
const cell = buildCellProp({ date_updated: MOCK_UNIX_TIMESTAMP });
|
|
53
|
-
const { container } = render(
|
|
54
|
-
<AssetsTableDateCellMemoized
|
|
55
|
-
cell={cell}
|
|
56
|
-
date_created={false}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
expect(formatDateDefault).toHaveBeenCalledWith(MOCK_UNIX_TIMESTAMP);
|
|
61
|
-
expect(container.textContent).toBe(MOCK_FORMATTED_DATE);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('prefers date_modified over date_updated when both exist', () => {
|
|
65
|
-
const modifiedTimestamp = 1776099600;
|
|
66
|
-
const cell = buildCellProp({
|
|
67
|
-
date_modified: modifiedTimestamp,
|
|
68
|
-
date_updated: MOCK_UNIX_TIMESTAMP
|
|
69
|
-
});
|
|
70
|
-
const { container } = render(
|
|
71
|
-
<AssetsTableDateCellMemoized
|
|
72
|
-
cell={cell}
|
|
73
|
-
date_created={false}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
expect(formatDateDefault).toHaveBeenCalledWith(modifiedTimestamp);
|
|
78
|
-
expect(container.textContent).toBe(MOCK_FORMATTED_DATE);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('skips date_created value when date_created prop is false', () => {
|
|
82
|
-
vi.mocked(formatDateDefault).mockClear();
|
|
83
|
-
const cell = buildCellProp({ date_created: MOCK_UNIX_TIMESTAMP });
|
|
84
|
-
const { container } = render(
|
|
85
|
-
<AssetsTableDateCellMemoized
|
|
86
|
-
cell={cell}
|
|
87
|
-
date_created={false}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
expect(formatDateDefault).not.toHaveBeenCalled();
|
|
92
|
-
expect(container.innerHTML).toBe('');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('returns null when no date values are present', () => {
|
|
96
|
-
const cell = buildCellProp({});
|
|
97
|
-
const { container } = render(
|
|
98
|
-
<AssetsTableDateCellMemoized
|
|
99
|
-
cell={cell}
|
|
100
|
-
date_created={false}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(container.innerHTML).toBe('');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
|
|
5
|
-
let capturedDropConfig: any = {};
|
|
6
|
-
|
|
7
|
-
vi.mock('react-dnd', () => ({
|
|
8
|
-
useDrop: (configFn: () => any) => {
|
|
9
|
-
capturedDropConfig = typeof configFn === 'function' ? configFn() : configFn;
|
|
10
|
-
const refCallback = vi.fn();
|
|
11
|
-
return [{}, refCallback];
|
|
12
|
-
}
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
vi.mock('react-dnd-html5-backend', () => ({
|
|
16
|
-
NativeTypes: { FILE: '__NATIVE_FILE__' }
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
import AssetsTableDropzone from './AssetsTableDropzone';
|
|
20
|
-
|
|
21
|
-
describe('AssetsTableDropzone', () => {
|
|
22
|
-
it('renders children inside a div', () => {
|
|
23
|
-
const { getByText } = render(
|
|
24
|
-
<AssetsTableDropzone onDrop={vi.fn()}>
|
|
25
|
-
<span>Drop here</span>
|
|
26
|
-
</AssetsTableDropzone>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
expect(getByText('Drop here')).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('applies the provided className', () => {
|
|
33
|
-
const { container } = render(
|
|
34
|
-
<AssetsTableDropzone
|
|
35
|
-
onDrop={vi.fn()}
|
|
36
|
-
className='custom-zone'>
|
|
37
|
-
<span>content</span>
|
|
38
|
-
</AssetsTableDropzone>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
expect(container?.firstElementChild?.className).toBe('custom-zone');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('defaults to empty className when none is provided', () => {
|
|
45
|
-
const { container } = render(
|
|
46
|
-
<AssetsTableDropzone onDrop={vi.fn()}>
|
|
47
|
-
<span>content</span>
|
|
48
|
-
</AssetsTableDropzone>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
expect(container?.firstElementChild?.className).toBe('');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('accepts NativeTypes.FILE in the drop config', () => {
|
|
55
|
-
render(
|
|
56
|
-
<AssetsTableDropzone onDrop={vi.fn()}>
|
|
57
|
-
<span>content</span>
|
|
58
|
-
</AssetsTableDropzone>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
expect(capturedDropConfig.accept).toContain('__NATIVE_FILE__');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('calls onDrop with props and monitor when an item is dropped', () => {
|
|
65
|
-
const onDrop = vi.fn();
|
|
66
|
-
render(
|
|
67
|
-
<AssetsTableDropzone onDrop={onDrop}>
|
|
68
|
-
<span>content</span>
|
|
69
|
-
</AssetsTableDropzone>
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const mockMonitor = { isOver: vi.fn(), canDrop: vi.fn() };
|
|
73
|
-
capturedDropConfig.drop({}, mockMonitor);
|
|
74
|
-
|
|
75
|
-
expect(onDrop).toHaveBeenCalledWith(expect.objectContaining({ onDrop }), mockMonitor);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('does not throw when onDrop is falsy', () => {
|
|
79
|
-
render(
|
|
80
|
-
<AssetsTableDropzone onDrop={undefined as any}>
|
|
81
|
-
<span>content</span>
|
|
82
|
-
</AssetsTableDropzone>
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const mockMonitor = { isOver: vi.fn(), canDrop: vi.fn() };
|
|
86
|
-
expect(() => capturedDropConfig.drop({}, mockMonitor)).not.toThrow();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('uses onExternalCollect when provided', () => {
|
|
90
|
-
const onExternalCollect = vi.fn(() => ({ custom: true }));
|
|
91
|
-
render(
|
|
92
|
-
<AssetsTableDropzone
|
|
93
|
-
onDrop={vi.fn()}
|
|
94
|
-
onExternalCollect={onExternalCollect}>
|
|
95
|
-
<span>content</span>
|
|
96
|
-
</AssetsTableDropzone>
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
const mockMonitor = { isOver: vi.fn(), canDrop: vi.fn() };
|
|
100
|
-
const result = capturedDropConfig.collect(mockMonitor);
|
|
101
|
-
|
|
102
|
-
expect(onExternalCollect).toHaveBeenCalledWith(mockMonitor);
|
|
103
|
-
expect(result).toEqual({ custom: true });
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('uses default collect when onExternalCollect is not provided', () => {
|
|
107
|
-
render(
|
|
108
|
-
<AssetsTableDropzone onDrop={vi.fn()}>
|
|
109
|
-
<span>content</span>
|
|
110
|
-
</AssetsTableDropzone>
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const mockIsOver = vi.fn();
|
|
114
|
-
const mockCanDrop = vi.fn();
|
|
115
|
-
const mockMonitor = { isOver: mockIsOver, canDrop: mockCanDrop };
|
|
116
|
-
const result = capturedDropConfig.collect(mockMonitor);
|
|
117
|
-
|
|
118
|
-
expect(result).toEqual({ isOver: mockIsOver, canDrop: mockCanDrop });
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('does not attach dropRef when disable is true', () => {
|
|
122
|
-
const { container } = render(
|
|
123
|
-
<AssetsTableDropzone
|
|
124
|
-
onDrop={vi.fn()}
|
|
125
|
-
disable={true}>
|
|
126
|
-
<span>content</span>
|
|
127
|
-
</AssetsTableDropzone>
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
expect(container.firstElementChild).toBeTruthy();
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
|
|
5
|
-
const MOCK_DURATION = '00:01:30:00';
|
|
6
|
-
const MOCK_AUDIO_DURATION = '00:02:15';
|
|
7
|
-
|
|
8
|
-
vi.mock('../../Util', async (importOriginal) => {
|
|
9
|
-
const actual = (await importOriginal()) as any;
|
|
10
|
-
return {
|
|
11
|
-
...actual,
|
|
12
|
-
getDuration: vi.fn(() => MOCK_DURATION),
|
|
13
|
-
formatAudioDuration: vi.fn(() => MOCK_AUDIO_DURATION)
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
import AssetsTableDurationCell, { secondsToTime } from './AssetsTableDurationCell';
|
|
18
|
-
import { getDuration, formatAudioDuration } from '../../Util';
|
|
19
|
-
import { ASSET_TYPES } from '../../constants/assets';
|
|
20
|
-
|
|
21
|
-
const buildCellProp = (overrides: Record<string, any> = {}) => ({
|
|
22
|
-
row: {
|
|
23
|
-
original: {
|
|
24
|
-
type: 'video',
|
|
25
|
-
data: '{}',
|
|
26
|
-
rate: 30,
|
|
27
|
-
frame_count: 2700,
|
|
28
|
-
duration: 0,
|
|
29
|
-
...overrides
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('AssetsTableDurationCell', () => {
|
|
35
|
-
it('renders duration using getDuration when rate and frame_count exist', () => {
|
|
36
|
-
const cell = buildCellProp({ type: 'video', rate: 30, frame_count: 2700 });
|
|
37
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
38
|
-
|
|
39
|
-
expect(getDuration).toHaveBeenCalledWith(2700, 30);
|
|
40
|
-
expect(container.querySelector('.asset-duration-cell')).toBeTruthy();
|
|
41
|
-
expect(container.textContent).toBe(MOCK_DURATION);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('renders empty duration when rate is missing', () => {
|
|
45
|
-
vi.mocked(getDuration).mockClear();
|
|
46
|
-
const cell = buildCellProp({ type: 'video', rate: null, frame_count: 100 });
|
|
47
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
48
|
-
|
|
49
|
-
expect(getDuration).not.toHaveBeenCalled();
|
|
50
|
-
expect(container.querySelector('.asset-duration-cell')).toBeTruthy();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('renders frame count for image_sequence type', () => {
|
|
54
|
-
const cell = buildCellProp({
|
|
55
|
-
type: ASSET_TYPES.IMAGE_SEQUENCE,
|
|
56
|
-
duration: 120,
|
|
57
|
-
rate: null,
|
|
58
|
-
frame_count: null
|
|
59
|
-
});
|
|
60
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
61
|
-
|
|
62
|
-
expect(container.textContent).toBe('120 frames');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('parses data JSON and renders duration for video_composition type', () => {
|
|
66
|
-
const compositionData = JSON.stringify({ frames: 900, rate: 24 });
|
|
67
|
-
const cell = buildCellProp({
|
|
68
|
-
type: ASSET_TYPES.VIDEO_COMPOSITION,
|
|
69
|
-
data: compositionData,
|
|
70
|
-
rate: null,
|
|
71
|
-
frame_count: null
|
|
72
|
-
});
|
|
73
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
74
|
-
|
|
75
|
-
expect(getDuration).toHaveBeenCalledWith(900, 24);
|
|
76
|
-
expect(container.textContent).toBe(MOCK_DURATION);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('renders formatted audio duration for audio type', () => {
|
|
80
|
-
const cell = buildCellProp({
|
|
81
|
-
type: ASSET_TYPES.AUDIO,
|
|
82
|
-
duration: 135,
|
|
83
|
-
rate: null,
|
|
84
|
-
frame_count: null
|
|
85
|
-
});
|
|
86
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
87
|
-
|
|
88
|
-
expect(formatAudioDuration).toHaveBeenCalledWith(135);
|
|
89
|
-
expect(container.textContent).toBe(MOCK_AUDIO_DURATION);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('renders empty div when duration is null', () => {
|
|
93
|
-
vi.mocked(getDuration).mockReturnValueOnce(null as any);
|
|
94
|
-
const cell = buildCellProp({ type: 'unknown', rate: 30, frame_count: 100 });
|
|
95
|
-
const { container } = render(<AssetsTableDurationCell cell={cell} />);
|
|
96
|
-
const durationCell = container.querySelector('.asset-duration-cell');
|
|
97
|
-
|
|
98
|
-
expect(durationCell).toBeTruthy();
|
|
99
|
-
expect(durationCell?.textContent).toBe('');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('secondsToTime', () => {
|
|
104
|
-
it('formats seconds into minutes:seconds', () => {
|
|
105
|
-
expect(secondsToTime(90)).toBe('1:30');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('pads single-digit seconds with a leading zero', () => {
|
|
109
|
-
expect(secondsToTime(65)).toBe('1:05');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('handles zero seconds', () => {
|
|
113
|
-
expect(secondsToTime(0)).toBe('0:00');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('handles large values', () => {
|
|
117
|
-
expect(secondsToTime(3661)).toBe('61:01');
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
|
|
5
|
-
vi.mock('../../constants/icons', () => ({
|
|
6
|
-
ICON_GLOBE: <span data-testid='icon-globe'>globe</span>
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
import AssetsTableGlobalCellMemoized from './AssetsTableGlobalCell';
|
|
10
|
-
|
|
11
|
-
const buildCellProp = (storyId: any) => ({
|
|
12
|
-
row: { original: { story_id: storyId } }
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('AssetsTableGlobalCell', () => {
|
|
16
|
-
it('hides the globe icon when story_id is a truthy string', () => {
|
|
17
|
-
const { container, queryByTestId } = render(
|
|
18
|
-
<AssetsTableGlobalCellMemoized cell={buildCellProp('story-123')} />
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
expect(container.querySelector('.asset-global-cell')).toBeTruthy();
|
|
22
|
-
expect(queryByTestId('icon-globe')).toBeNull();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('hides the globe icon when story_id is undefined', () => {
|
|
26
|
-
const { queryByTestId } = render(
|
|
27
|
-
<AssetsTableGlobalCellMemoized cell={buildCellProp(undefined)} />
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
expect(queryByTestId('icon-globe')).toBeNull();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('shows the globe icon when story_id is null', () => {
|
|
34
|
-
const { getByTestId } = render(
|
|
35
|
-
<AssetsTableGlobalCellMemoized cell={buildCellProp(null)} />
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
expect(getByTestId('icon-globe')).toBeTruthy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('shows the globe icon when story_id is an empty string', () => {
|
|
42
|
-
const { getByTestId } = render(<AssetsTableGlobalCellMemoized cell={buildCellProp('')} />);
|
|
43
|
-
|
|
44
|
-
expect(getByTestId('icon-globe')).toBeTruthy();
|
|
45
|
-
});
|
|
46
|
-
});
|