@tuturuuu/ui 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/biome.json +1 -1
- package/package.json +74 -71
- package/src/components/ui/accordion.tsx +1 -1
- package/src/components/ui/breadcrumb.tsx +1 -1
- package/src/components/ui/calendar-app/calendar-page-shell.tsx +4 -0
- package/src/components/ui/calendar-app/components/calendar-connections-settings-content.tsx +239 -33
- package/src/components/ui/calendar-app/components/load-smart-scheduling-tasks.tsx +143 -0
- package/src/components/ui/calendar-app/components/priority-view.tsx +10 -3
- package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +4 -116
- package/src/components/ui/calendar-app/components/use-calendar-connections-manager.ts +67 -2
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/carousel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-setup-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.tsx +2 -2
- package/src/components/ui/chat/chat-agent-details-utils.test.ts +1 -1
- package/src/components/ui/chat/chat-agent-details-utils.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-zalo-personal-panel.tsx +2 -2
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/context-menu.tsx +5 -1
- package/src/components/ui/custom/__tests__/settings-dialog-search.test.ts +78 -0
- package/src/components/ui/custom/__tests__/settings-dialog-shell-compile-graph.test.ts +76 -0
- package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +3 -0
- package/src/components/ui/custom/__tests__/workspace-select-helpers.test.ts +46 -1
- package/src/components/ui/custom/combobox.test.tsx +195 -0
- package/src/components/ui/custom/combobox.tsx +273 -156
- package/src/components/ui/custom/education/modules/youtube/delete-link-button.tsx +5 -13
- package/src/components/ui/custom/facebook-mockup/facebook-mockup.tsx +7 -1
- package/src/components/ui/custom/facebook-mockup/form.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/image-upload-field.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/preview.tsx +1 -1
- package/src/components/ui/custom/nav-link.test.tsx +165 -0
- package/src/components/ui/custom/nav-link.tsx +69 -11
- package/src/components/ui/custom/navigation.tsx +1 -0
- package/src/components/ui/custom/settings/task-settings.tsx +104 -0
- package/src/components/ui/custom/settings-dialog-search-loader.d.ts +5 -0
- package/src/components/ui/custom/settings-dialog-search-loader.js +3 -0
- package/src/components/ui/custom/settings-dialog-search.ts +75 -0
- package/src/components/ui/custom/settings-dialog-shell.tsx +65 -28
- package/src/components/ui/custom/theme-toggle.tsx +1 -1
- package/src/components/ui/custom/workspace-select-helpers.ts +23 -0
- package/src/components/ui/custom/workspace-select.tsx +25 -19
- package/src/components/ui/dialog.test.tsx +52 -0
- package/src/components/ui/dialog.tsx +6 -2
- package/src/components/ui/dropdown-menu.tsx +5 -1
- package/src/components/ui/finance/debts/debt-loan-form.tsx +12 -5
- package/src/components/ui/finance/debts/debt-loan-summary.tsx +3 -2
- package/src/components/ui/finance/debts/debts-page.test.tsx +54 -5
- package/src/components/ui/finance/debts/debts-page.tsx +15 -2
- package/src/components/ui/finance/invoices/components/subscription-group-selector.tsx +3 -5
- package/src/components/ui/finance/invoices/new-invoice-page.test.tsx +25 -5
- package/src/components/ui/finance/invoices/new-invoice-page.tsx +7 -2
- package/src/components/ui/finance/invoices/standard-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/subscription-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/utils.ts +3 -1
- package/src/components/ui/finance/transactions/form-content-dialog.tsx +3 -0
- package/src/components/ui/finance/transactions/form-types.ts +1 -0
- package/src/components/ui/finance/transactions/form.tsx +2 -0
- package/src/components/ui/finance/transactions/infinite-transactions-list.tsx +2 -0
- package/src/components/ui/finance/transactions/period-charts/category-breakdown-dialog.tsx +1 -1
- package/src/components/ui/finance/transactions/transaction-edit-dialog.tsx +1 -4
- package/src/components/ui/finance/transactions/transactions-create-summary.tsx +3 -0
- package/src/components/ui/finance/transactions/transactions-page.tsx +4 -1
- package/src/components/ui/finance/wallets/form.test.tsx +51 -3
- package/src/components/ui/finance/wallets/form.tsx +15 -4
- package/src/components/ui/finance/wallets/walletId/wallet-details-actions.tsx +4 -0
- package/src/components/ui/finance/wallets/walletId/wallet-details-page.tsx +4 -2
- package/src/components/ui/finance/wallets/wallets-data-table.tsx +1 -0
- package/src/components/ui/finance/wallets/wallets-page.tsx +5 -2
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/legacy/calendar/all-day-event-bar.tsx +28 -39
- package/src/components/ui/legacy/calendar/calendar-cell.tsx +2 -0
- package/src/components/ui/legacy/calendar/calendar-content.tsx +10 -6
- package/src/components/ui/legacy/calendar/calendar-header.tsx +23 -3
- package/src/components/ui/legacy/calendar/calendar-loading-skeleton.tsx +135 -0
- package/src/components/ui/legacy/calendar/calendar-matrix.tsx +175 -237
- package/src/components/ui/legacy/calendar/event-card.test.tsx +177 -0
- package/src/components/ui/legacy/calendar/event-card.tsx +220 -131
- package/src/components/ui/legacy/calendar/event-modal.tsx +17 -17
- package/src/components/ui/legacy/calendar/event-provider-display.tsx +69 -0
- package/src/components/ui/legacy/calendar/smart-calendar.test.tsx +86 -4
- package/src/components/ui/legacy/calendar/smart-calendar.tsx +32 -2
- package/src/components/ui/legacy/meet/create-plan-dialog.tsx +19 -10
- package/src/components/ui/navigation-menu.tsx +1 -1
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/select.tsx +5 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/storefront/cart-popover.tsx +61 -0
- package/src/components/ui/storefront/cart-summary-parts.tsx +290 -0
- package/src/components/ui/storefront/cart-summary.tsx +93 -154
- package/src/components/ui/storefront/checkout-overlay.tsx +4 -5
- package/src/components/ui/storefront/listing-card.tsx +1 -1
- package/src/components/ui/storefront/merch-sections.tsx +70 -0
- package/src/components/ui/storefront/product-detail.tsx +1 -1
- package/src/components/ui/storefront/storefront-surface.test.tsx +106 -11
- package/src/components/ui/storefront/storefront-surface.tsx +101 -166
- package/src/components/ui/storefront/types.ts +4 -0
- package/src/components/ui/storefront/utils.ts +6 -0
- package/src/components/ui/text-editor/__tests__/extensions.test.ts +123 -0
- package/src/components/ui/text-editor/background-color-extension.ts +62 -0
- package/src/components/ui/text-editor/color-controls.tsx +284 -0
- package/src/components/ui/text-editor/editor.tsx +69 -14
- package/src/components/ui/text-editor/extensions.ts +8 -2
- package/src/components/ui/text-editor/highlight-extension.ts +22 -0
- package/src/components/ui/text-editor/tool-bar.tsx +9 -16
- package/src/components/ui/toast.tsx +1 -1
- package/src/components/ui/tu-do/boards/__tests__/board-share-dialog.test.tsx +286 -0
- package/src/components/ui/tu-do/boards/__tests__/task-board-form.test.tsx +12 -0
- package/src/components/ui/tu-do/boards/board-public-link-section.tsx +231 -0
- package/src/components/ui/tu-do/boards/board-share-dialog.tsx +15 -226
- package/src/components/ui/tu-do/boards/board-share-settings-panel.tsx +351 -0
- package/src/components/ui/tu-do/boards/boardId/board-column.tsx +121 -39
- package/src/components/ui/tu-do/boards/boardId/enhanced-task-list.tsx +7 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +2 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +5 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-types.ts +3 -3
- package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +50 -2
- package/src/components/ui/tu-do/boards/boardId/kanban/data/use-bulk-resources.ts +59 -5
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +17 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +4 -1
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/drag-preview.tsx +20 -1
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +38 -9
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +2 -8
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-sort-key.ts +47 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +81 -30
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/__tests__/kanban-planner-island.test.tsx +380 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/kanban-planner-dialog.tsx +204 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-digest-panel.tsx +61 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-item-strip.tsx +54 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-plan-toolbar.tsx +251 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-scope-badge.tsx +27 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-section.tsx +58 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-share-dialog.tsx +238 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-target-controls.tsx +143 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-utils.ts +65 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/use-kanban-planner-state.ts +234 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +642 -5
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +224 -15
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +535 -53
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +101 -33
- package/src/components/ui/tu-do/boards/boardId/kanban.tsx +235 -113
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.test.tsx +50 -5
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +12 -2
- package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +10 -1
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.test.ts +20 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.ts +10 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +271 -36
- package/src/components/ui/tu-do/boards/boardId/task-filter.test.tsx +152 -0
- package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +555 -545
- package/src/components/ui/tu-do/boards/boardId/task-list.tsx +22 -0
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-grid.tsx +9 -0
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-task-row.tsx +9 -0
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-toolbar.tsx +9 -0
- package/src/components/ui/tu-do/boards/boardId/timeline-board.tsx +35 -3
- package/src/components/ui/tu-do/boards/form.tsx +1 -1
- package/src/components/ui/tu-do/boards/share-section.tsx +100 -0
- package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +10 -12
- package/src/components/ui/tu-do/drafts/drafts-page.tsx +33 -16
- package/src/components/ui/tu-do/hooks/__tests__/useTaskLabelManagement.test.tsx +48 -0
- package/src/components/ui/tu-do/hooks/__tests__/useTaskProjectManagement.test.tsx +144 -0
- package/src/components/ui/tu-do/hooks/useTaskDialog.ts +7 -0
- package/src/components/ui/tu-do/hooks/useTaskLabelManagement.ts +115 -106
- package/src/components/ui/tu-do/hooks/useTaskProjectManagement.ts +115 -122
- package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +56 -88
- package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +26 -2
- package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +55 -8
- package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +1 -4
- package/src/components/ui/tu-do/progress/task-progress-import-panel.tsx +60 -0
- package/src/components/ui/tu-do/progress/task-progress-leaderboards-panel.tsx +156 -0
- package/src/components/ui/tu-do/progress/task-progress-page.tsx +348 -0
- package/src/components/ui/tu-do/progress/task-progress-panels.tsx +301 -0
- package/src/components/ui/tu-do/providers/task-dialog-provider.tsx +26 -0
- package/src/components/ui/tu-do/shared/__tests__/assignee-select.test.tsx +81 -10
- package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +141 -1
- package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +377 -36
- package/src/components/ui/tu-do/shared/__tests__/board-switcher.test.tsx +374 -0
- package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +419 -5
- package/src/components/ui/tu-do/shared/__tests__/task-board-loading-state.test.tsx +38 -0
- package/src/components/ui/tu-do/shared/__tests__/task-cache-patches.test.ts +147 -0
- package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +16 -0
- package/src/components/ui/tu-do/shared/__tests__/use-progressive-board-loader.test.tsx +3 -0
- package/src/components/ui/tu-do/shared/assignee-select.tsx +77 -26
- package/src/components/ui/tu-do/shared/board-client.tsx +15 -10
- package/src/components/ui/tu-do/shared/board-config-storage.ts +7 -1
- package/src/components/ui/tu-do/shared/board-header.tsx +471 -975
- package/src/components/ui/tu-do/shared/board-layout-settings.tsx +165 -136
- package/src/components/ui/tu-do/shared/board-switcher.tsx +244 -220
- package/src/components/ui/tu-do/shared/board-user-presence-avatars.tsx +18 -12
- package/src/components/ui/tu-do/shared/board-views.tsx +577 -85
- package/src/components/ui/tu-do/shared/list-view.tsx +246 -2
- package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +142 -94
- package/src/components/ui/tu-do/shared/special-task-list-pins.ts +51 -0
- package/src/components/ui/tu-do/shared/task-board-loading-state.tsx +28 -0
- package/src/components/ui/tu-do/shared/task-cache-patches.ts +394 -0
- package/src/components/ui/tu-do/shared/task-dialog-manager.tsx +21 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/quick-settings-popover.tsx +5 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-dialog-header.tsx +25 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-selector.tsx +7 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +3 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-data.ts +79 -10
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-mutations.ts +76 -77
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.test.tsx +63 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.ts +78 -69
- package/src/components/ui/tu-do/shared/task-edit-dialog/personal-overrides-section.tsx +28 -8
- package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/dependencies-section.tsx +14 -3
- package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/parent-section.tsx +6 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/related-section.tsx +6 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/subtasks-section.tsx +6 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/types/task-relationships.types.ts +8 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.test.tsx +91 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +123 -78
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +7 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-dialog-actions.tsx +8 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.test.tsx +150 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.tsx +61 -35
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-relationships-properties.tsx +44 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +8 -3
- package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +11 -1
- package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +2 -9
- package/src/components/ui/tu-do/shared/task-row-actions-menu.tsx +11 -0
- package/src/components/ui/tu-do/shared/use-progressive-board-loader.ts +2 -0
- package/src/declarations.d.ts +1 -0
- package/src/hooks/__tests__/use-calendar-readonly.test.tsx +322 -2
- package/src/hooks/__tests__/use-calendar-sync.test.tsx +446 -0
- package/src/hooks/__tests__/useBoardPresence.test.tsx +191 -0
- package/src/hooks/__tests__/useBoardRealtime.test.tsx +24 -144
- package/src/hooks/use-calendar-sync.tsx +247 -243
- package/src/hooks/use-calendar.tsx +323 -138
- package/src/hooks/use-task-actions.ts +24 -0
- package/src/hooks/use-user-workspace-config.ts +75 -0
- package/src/hooks/use-workspace-currency.ts +8 -3
- package/src/hooks/useBoardPresence.ts +364 -0
- package/src/hooks/useBoardRealtimeEventHandler.ts +45 -90
- package/src/lib/workspace-actions.ts +2 -6
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import '@testing-library/jest-dom';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
6
|
import { BoardHeader } from '../board-header';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const navigationMocks = vi.hoisted(() => ({
|
|
9
|
+
replace: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
const internalApiMocks = vi.hoisted(() => ({
|
|
12
|
+
getWorkspaceTaskBoard: vi.fn(),
|
|
13
|
+
}));
|
|
14
|
+
const comboboxMocks = vi.hoisted(() => ({
|
|
15
|
+
seenOptions: [] as { description?: string; label: string; value: string }[][],
|
|
16
|
+
}));
|
|
13
17
|
|
|
14
18
|
vi.mock('next-intl', () => ({
|
|
15
19
|
useTranslations: () => (key: string) => key,
|
|
16
20
|
}));
|
|
17
21
|
|
|
18
22
|
vi.mock('next/navigation', () => ({
|
|
23
|
+
usePathname: () => '/ws-1/tasks/boards/board-1',
|
|
19
24
|
useRouter: () => ({
|
|
20
25
|
push: vi.fn(),
|
|
21
|
-
replace:
|
|
26
|
+
replace: navigationMocks.replace,
|
|
22
27
|
refresh: vi.fn(),
|
|
23
28
|
}),
|
|
29
|
+
useSearchParams: () => new URLSearchParams('existing=1'),
|
|
24
30
|
}));
|
|
25
31
|
|
|
26
32
|
vi.mock('next/link', () => ({
|
|
@@ -40,23 +46,95 @@ vi.mock('@tuturuuu/ui/hooks/use-board-actions', () => ({
|
|
|
40
46
|
}),
|
|
41
47
|
}));
|
|
42
48
|
|
|
43
|
-
vi.mock('
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
vi.mock('@tuturuuu/ui/custom/combobox', () => ({
|
|
50
|
+
Combobox: function MockCombobox({
|
|
51
|
+
ariaLabel,
|
|
52
|
+
className,
|
|
53
|
+
colorizeTriggerIcon,
|
|
54
|
+
disabled,
|
|
55
|
+
hideTriggerLabel,
|
|
56
|
+
onChange,
|
|
57
|
+
options,
|
|
58
|
+
placeholder,
|
|
59
|
+
selected,
|
|
60
|
+
triggerIcon,
|
|
61
|
+
triggerTooltip,
|
|
62
|
+
}: {
|
|
63
|
+
ariaLabel?: string;
|
|
64
|
+
className?: string;
|
|
65
|
+
colorizeTriggerIcon?: boolean;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
hideTriggerLabel?: boolean;
|
|
68
|
+
onChange?: (value: string) => void;
|
|
69
|
+
options: { description?: string; label: string; value: string }[];
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
selected: string;
|
|
72
|
+
triggerIcon?: React.ReactNode;
|
|
73
|
+
triggerTooltip?: React.ReactNode;
|
|
74
|
+
}) {
|
|
75
|
+
comboboxMocks.seenOptions.push(options);
|
|
46
76
|
|
|
47
|
-
vi.mock('../board-layout-settings', () => ({
|
|
48
|
-
BoardLayoutSettings: (props: any) => {
|
|
49
|
-
boardLayoutSettingsProps = props;
|
|
50
77
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
78
|
+
<select
|
|
79
|
+
aria-label={
|
|
80
|
+
ariaLabel ??
|
|
81
|
+
(hideTriggerLabel
|
|
82
|
+
? options.find((option) => option.value === selected)?.label
|
|
83
|
+
: placeholder)
|
|
84
|
+
}
|
|
85
|
+
className={className}
|
|
86
|
+
data-colorize-trigger-icon={String(colorizeTriggerIcon)}
|
|
87
|
+
data-has-trigger-icon={String(Boolean(triggerIcon))}
|
|
88
|
+
data-trigger-tooltip={
|
|
89
|
+
typeof triggerTooltip === 'string' ? triggerTooltip : undefined
|
|
90
|
+
}
|
|
91
|
+
disabled={disabled}
|
|
92
|
+
value={selected}
|
|
93
|
+
onChange={(event) => onChange?.(event.target.value)}
|
|
94
|
+
>
|
|
95
|
+
{options.map((option) => (
|
|
96
|
+
<option key={option.value} value={option.value}>
|
|
97
|
+
{option.label}
|
|
98
|
+
</option>
|
|
99
|
+
))}
|
|
100
|
+
</select>
|
|
56
101
|
);
|
|
57
102
|
},
|
|
58
103
|
}));
|
|
59
104
|
|
|
105
|
+
vi.mock('@tuturuuu/internal-api/tasks', () => ({
|
|
106
|
+
getWorkspaceTaskBoard: (
|
|
107
|
+
...args: Parameters<typeof internalApiMocks.getWorkspaceTaskBoard>
|
|
108
|
+
) => internalApiMocks.getWorkspaceTaskBoard(...args),
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
vi.mock('@tuturuuu/ui/dropdown-menu', () => ({
|
|
112
|
+
DropdownMenu: ({ children }: { children: React.ReactNode }) => (
|
|
113
|
+
<div>{children}</div>
|
|
114
|
+
),
|
|
115
|
+
DropdownMenuContent: ({ children }: { children: React.ReactNode }) => (
|
|
116
|
+
<div>{children}</div>
|
|
117
|
+
),
|
|
118
|
+
DropdownMenuItem: ({
|
|
119
|
+
children,
|
|
120
|
+
onClick,
|
|
121
|
+
}: {
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
onClick?: () => void;
|
|
124
|
+
}) => (
|
|
125
|
+
<button onClick={onClick} type="button">
|
|
126
|
+
{children}
|
|
127
|
+
</button>
|
|
128
|
+
),
|
|
129
|
+
DropdownMenuTrigger: ({ children }: { children: React.ReactNode }) => (
|
|
130
|
+
<>{children}</>
|
|
131
|
+
),
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
vi.mock('../tasks-route-context', () => ({
|
|
135
|
+
useTasksHref: () => '/tasks',
|
|
136
|
+
}));
|
|
137
|
+
|
|
60
138
|
vi.mock('../board-switcher', () => ({
|
|
61
139
|
BoardSwitcher: () => <div data-testid="board-switcher" />,
|
|
62
140
|
}));
|
|
@@ -71,6 +149,16 @@ vi.mock('../boards/boardId/task-filter', () => ({
|
|
|
71
149
|
TaskFilter: () => <div data-testid="task-filter" />,
|
|
72
150
|
}));
|
|
73
151
|
|
|
152
|
+
vi.mock('../boards/boardId/kanban/planner/kanban-planner-dialog', () => ({
|
|
153
|
+
KanbanPlannerDialog: ({ open }: { open: boolean }) =>
|
|
154
|
+
open ? <div role="dialog">planner-dialog</div> : null,
|
|
155
|
+
}));
|
|
156
|
+
|
|
157
|
+
vi.mock('../boards/board-share-dialog', () => ({
|
|
158
|
+
BoardShareDialog: ({ open }: { open: boolean }) =>
|
|
159
|
+
open ? <div role="dialog">share-dialog</div> : null,
|
|
160
|
+
}));
|
|
161
|
+
|
|
74
162
|
vi.mock('../boards/copy-board-dialog', () => ({
|
|
75
163
|
CopyBoardDialog: () => <div data-testid="copy-board-dialog" />,
|
|
76
164
|
}));
|
|
@@ -137,36 +225,289 @@ function renderBoardHeader(
|
|
|
137
225
|
|
|
138
226
|
describe('BoardHeader', () => {
|
|
139
227
|
beforeEach(() => {
|
|
140
|
-
|
|
228
|
+
comboboxMocks.seenOptions = [];
|
|
229
|
+
navigationMocks.replace.mockReset();
|
|
230
|
+
internalApiMocks.getWorkspaceTaskBoard.mockReset();
|
|
231
|
+
internalApiMocks.getWorkspaceTaskBoard.mockResolvedValue({
|
|
232
|
+
board: mockBoard,
|
|
233
|
+
});
|
|
141
234
|
});
|
|
142
235
|
|
|
143
|
-
it('
|
|
236
|
+
it('renders a direct board settings button with compact outline header styling', () => {
|
|
144
237
|
renderBoardHeader();
|
|
145
238
|
|
|
146
|
-
|
|
147
|
-
'
|
|
148
|
-
|
|
239
|
+
const settingsButton = screen.getByRole('button', {
|
|
240
|
+
name: 'ws-task-boards.actions.board_settings',
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
expect(settingsButton).toHaveClass('border', 'h-7', 'w-7', 'px-0');
|
|
244
|
+
expect(settingsButton).toHaveClass('sm:h-8', 'sm:w-8');
|
|
245
|
+
expect(settingsButton).not.toHaveTextContent(
|
|
246
|
+
'ws-task-boards.actions.board_settings'
|
|
149
247
|
);
|
|
150
|
-
expect(boardLayoutSettingsProps?.boardId).toBe('board-1');
|
|
151
|
-
expect(boardLayoutSettingsProps?.wsId).toBe('ws-1');
|
|
152
248
|
});
|
|
153
249
|
|
|
154
|
-
it('
|
|
250
|
+
it('prefetches current board settings before opening the dialog', async () => {
|
|
251
|
+
renderBoardHeader();
|
|
252
|
+
|
|
253
|
+
fireEvent.mouseEnter(
|
|
254
|
+
screen.getByRole('button', {
|
|
255
|
+
name: 'ws-task-boards.actions.board_settings',
|
|
256
|
+
})
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
await waitFor(() => {
|
|
260
|
+
expect(internalApiMocks.getWorkspaceTaskBoard).toHaveBeenCalledWith(
|
|
261
|
+
'ws-1',
|
|
262
|
+
'board-1',
|
|
263
|
+
expect.objectContaining({ baseUrl: expect.any(String) })
|
|
264
|
+
);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('calls the board settings intent hook before opening the dialog', () => {
|
|
269
|
+
const onBoardSettingsIntent = vi.fn();
|
|
270
|
+
|
|
271
|
+
renderBoardHeader({ onBoardSettingsIntent });
|
|
272
|
+
|
|
273
|
+
fireEvent.pointerDown(
|
|
274
|
+
screen.getByRole('button', {
|
|
275
|
+
name: 'ws-task-boards.actions.board_settings',
|
|
276
|
+
})
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
expect(onBoardSettingsIntent).toHaveBeenCalledTimes(1);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it('opens contextual board settings through query state', () => {
|
|
283
|
+
renderBoardHeader();
|
|
284
|
+
|
|
285
|
+
fireEvent.click(
|
|
286
|
+
screen.getByRole('button', {
|
|
287
|
+
name: 'ws-task-boards.actions.board_settings',
|
|
288
|
+
})
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
expect(navigationMocks.replace).toHaveBeenCalledWith(
|
|
292
|
+
'/ws-1/tasks/boards/board-1?existing=1&settingsDialog=open&settingsTab=task_board&settingsBoardId=board-1',
|
|
293
|
+
{ scroll: false }
|
|
294
|
+
);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('renders a natural public title and hides member-only controls in read-only mode', () => {
|
|
298
|
+
renderBoardHeader({
|
|
299
|
+
publicView: true,
|
|
300
|
+
readOnly: true,
|
|
301
|
+
titlePrefix: <span data-testid="public-title-prefix">Tuturuuu /</span>,
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
expect(screen.queryByTestId('board-switcher')).not.toBeInTheDocument();
|
|
305
|
+
expect(screen.getByTestId('public-title-prefix')).toBeInTheDocument();
|
|
306
|
+
expect(screen.getByText('Roadmap')).toBeInTheDocument();
|
|
307
|
+
expect(screen.queryByTestId('board-user-presence')).not.toBeInTheDocument();
|
|
308
|
+
expect(screen.queryByTestId('task-filter')).not.toBeInTheDocument();
|
|
309
|
+
expect(
|
|
310
|
+
screen.queryByLabelText('ws-task-boards.share.action')
|
|
311
|
+
).not.toBeInTheDocument();
|
|
312
|
+
expect(
|
|
313
|
+
screen.queryByLabelText('ws-task-plans.planner')
|
|
314
|
+
).not.toBeInTheDocument();
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('hides the board picker when showing My Tasks', () => {
|
|
318
|
+
renderBoardHeader({
|
|
319
|
+
currentView: 'my_tasks',
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
expect(screen.queryByTestId('board-switcher')).not.toBeInTheDocument();
|
|
323
|
+
expect(
|
|
324
|
+
screen.getByText('ws-task-boards.views.my_tasks')
|
|
325
|
+
).toBeInTheDocument();
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it('shows planner as a personal kanban toolbar button and opens the dialog', () => {
|
|
329
|
+
renderBoardHeader({
|
|
330
|
+
isPersonalWorkspace: true,
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
fireEvent.click(screen.getByLabelText('ws-task-plans.planner'));
|
|
334
|
+
|
|
335
|
+
expect(screen.getByRole('dialog')).toHaveTextContent('planner');
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it('hides planner outside personal kanban editing', () => {
|
|
339
|
+
const { rerender } = renderBoardHeader({
|
|
340
|
+
currentView: 'list',
|
|
341
|
+
isPersonalWorkspace: true,
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
expect(
|
|
345
|
+
screen.queryByLabelText('ws-task-plans.planner')
|
|
346
|
+
).not.toBeInTheDocument();
|
|
347
|
+
|
|
348
|
+
rerender(
|
|
349
|
+
<QueryClientProvider client={new QueryClient()}>
|
|
350
|
+
<BoardHeader
|
|
351
|
+
workspaceId="ws-1"
|
|
352
|
+
board={mockBoard}
|
|
353
|
+
currentView="kanban"
|
|
354
|
+
filters={{
|
|
355
|
+
assignees: [],
|
|
356
|
+
dueDateRange: null,
|
|
357
|
+
estimationRange: null,
|
|
358
|
+
includeMyTasks: false,
|
|
359
|
+
includeUnassigned: false,
|
|
360
|
+
labels: [],
|
|
361
|
+
priorities: [],
|
|
362
|
+
projects: [],
|
|
363
|
+
sourceBoardIds: [],
|
|
364
|
+
sourceScope: 'all_visible',
|
|
365
|
+
sourceWorkspaceIds: [],
|
|
366
|
+
}}
|
|
367
|
+
isMultiSelectMode={false}
|
|
368
|
+
isPersonalWorkspace
|
|
369
|
+
listStatusFilter="all"
|
|
370
|
+
onFiltersChange={vi.fn()}
|
|
371
|
+
onListStatusFilterChange={vi.fn()}
|
|
372
|
+
onUpdate={vi.fn()}
|
|
373
|
+
onViewChange={vi.fn()}
|
|
374
|
+
publicView
|
|
375
|
+
setIsMultiSelectMode={vi.fn()}
|
|
376
|
+
/>
|
|
377
|
+
</QueryClientProvider>
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
expect(
|
|
381
|
+
screen.queryByLabelText('ws-task-plans.planner')
|
|
382
|
+
).not.toBeInTheDocument();
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
it('shows presence avatars for workspace boards', () => {
|
|
386
|
+
renderBoardHeader();
|
|
387
|
+
|
|
388
|
+
expect(screen.getByTestId('board-user-presence')).toBeInTheDocument();
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('hides presence avatars for unshared personal boards', () => {
|
|
392
|
+
renderBoardHeader({
|
|
393
|
+
isPersonalWorkspace: true,
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
expect(screen.queryByTestId('board-user-presence')).not.toBeInTheDocument();
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it('shows presence avatars for personal boards shared with guests', () => {
|
|
400
|
+
renderBoardHeader({
|
|
401
|
+
board: {
|
|
402
|
+
...mockBoard,
|
|
403
|
+
has_guest_access: true,
|
|
404
|
+
},
|
|
405
|
+
isPersonalWorkspace: true,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
expect(screen.getByTestId('board-user-presence')).toBeInTheDocument();
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('shows presence avatars for direct board guest access', () => {
|
|
155
412
|
renderBoardHeader({
|
|
156
|
-
workspaceId: 'ws-fallback',
|
|
157
413
|
board: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
name: 'Roadmap',
|
|
161
|
-
ticket_prefix: 'RD',
|
|
162
|
-
ws_id: null,
|
|
414
|
+
...mockBoard,
|
|
415
|
+
access_type: 'guest',
|
|
163
416
|
},
|
|
417
|
+
isPersonalWorkspace: true,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
expect(screen.getByTestId('board-user-presence')).toBeInTheDocument();
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
it('updates status, view, and sort through combobox controls', () => {
|
|
424
|
+
const onFiltersChange = vi.fn();
|
|
425
|
+
const onListStatusFilterChange = vi.fn();
|
|
426
|
+
const onViewChange = vi.fn();
|
|
427
|
+
|
|
428
|
+
renderBoardHeader({
|
|
429
|
+
onFiltersChange,
|
|
430
|
+
onListStatusFilterChange,
|
|
431
|
+
onViewChange,
|
|
164
432
|
});
|
|
165
433
|
|
|
166
|
-
|
|
167
|
-
'
|
|
168
|
-
|
|
434
|
+
fireEvent.change(screen.getByLabelText('common.all'), {
|
|
435
|
+
target: { value: 'active' },
|
|
436
|
+
});
|
|
437
|
+
expect(onListStatusFilterChange).toHaveBeenCalledWith('active');
|
|
438
|
+
|
|
439
|
+
fireEvent.change(screen.getByLabelText('ws-task-boards.views.kanban'), {
|
|
440
|
+
target: { value: 'list' },
|
|
441
|
+
});
|
|
442
|
+
expect(onViewChange).toHaveBeenCalledWith('list');
|
|
443
|
+
|
|
444
|
+
fireEvent.change(screen.getByLabelText('common.sort'), {
|
|
445
|
+
target: { value: 'priority-high' },
|
|
446
|
+
});
|
|
447
|
+
expect(onFiltersChange).toHaveBeenCalledWith(
|
|
448
|
+
expect.objectContaining({ sortBy: 'priority-high' })
|
|
169
449
|
);
|
|
170
|
-
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('uses short board view descriptions including drafts and recycle bin keys', () => {
|
|
453
|
+
renderBoardHeader({
|
|
454
|
+
availableViews: ['kanban', 'list', 'timeline', 'drafts', 'recycle_bin'],
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
const viewOptions = comboboxMocks.seenOptions.find((options) =>
|
|
458
|
+
options.some((option) => option.value === 'kanban')
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
expect(viewOptions).toEqual(
|
|
462
|
+
expect.arrayContaining([
|
|
463
|
+
expect.objectContaining({
|
|
464
|
+
value: 'kanban',
|
|
465
|
+
description: 'ws-task-boards.views.kanban_description',
|
|
466
|
+
}),
|
|
467
|
+
expect.objectContaining({
|
|
468
|
+
value: 'list',
|
|
469
|
+
description: 'ws-task-boards.views.list_description',
|
|
470
|
+
}),
|
|
471
|
+
expect.objectContaining({
|
|
472
|
+
value: 'timeline',
|
|
473
|
+
description: 'ws-task-boards.views.timeline_description',
|
|
474
|
+
}),
|
|
475
|
+
expect.objectContaining({
|
|
476
|
+
value: 'drafts',
|
|
477
|
+
description: 'task-drafts.board_view_description',
|
|
478
|
+
}),
|
|
479
|
+
expect.objectContaining({
|
|
480
|
+
value: 'recycle_bin',
|
|
481
|
+
description: 'common.recycle_bin_board_description',
|
|
482
|
+
}),
|
|
483
|
+
])
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it('passes instant tooltip labels and monochrome trigger mode to toolbar comboboxes', () => {
|
|
488
|
+
renderBoardHeader();
|
|
489
|
+
|
|
490
|
+
const status = screen.getByLabelText('common.all');
|
|
491
|
+
const view = screen.getByLabelText('ws-task-boards.views.kanban');
|
|
492
|
+
const sort = screen.getByLabelText('common.sort');
|
|
493
|
+
|
|
494
|
+
expect(status).toHaveAttribute(
|
|
495
|
+
'data-trigger-tooltip',
|
|
496
|
+
'common.status: common.all'
|
|
497
|
+
);
|
|
498
|
+
expect(view).toHaveAttribute(
|
|
499
|
+
'data-trigger-tooltip',
|
|
500
|
+
'common.view: ws-task-boards.views.kanban'
|
|
501
|
+
);
|
|
502
|
+
expect(view).toHaveAttribute('data-has-trigger-icon', 'true');
|
|
503
|
+
expect(sort).toHaveAttribute(
|
|
504
|
+
'data-trigger-tooltip',
|
|
505
|
+
'common.sort: common.sort'
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
for (const control of [status, view, sort]) {
|
|
509
|
+
expect(control).toHaveAttribute('data-colorize-trigger-icon', 'false');
|
|
510
|
+
expect(control.className).toContain('[&_button_svg]:text-current');
|
|
511
|
+
}
|
|
171
512
|
});
|
|
172
513
|
});
|