feat(FN-1918): merge fusion/fn-1918
This commit is contained in:
@@ -1743,12 +1743,13 @@ export function RoadmapsView({ projectId, addToast }: RoadmapsViewProps) {
|
|||||||
|
|
||||||
// Roadmap handlers
|
// Roadmap handlers
|
||||||
const handleStartRoadmapEdit = useCallback((roadmap: Roadmap) => {
|
const handleStartRoadmapEdit = useCallback((roadmap: Roadmap) => {
|
||||||
|
selectRoadmap(roadmap.id);
|
||||||
setRoadmapEdit({
|
setRoadmapEdit({
|
||||||
roadmapId: roadmap.id,
|
roadmapId: roadmap.id,
|
||||||
field: "title",
|
field: "title",
|
||||||
value: roadmap.title,
|
value: roadmap.title,
|
||||||
});
|
});
|
||||||
}, []);
|
}, [selectRoadmap]);
|
||||||
|
|
||||||
const handleCancelRoadmapEdit = useCallback(() => {
|
const handleCancelRoadmapEdit = useCallback(() => {
|
||||||
setRoadmapEdit({ roadmapId: null, field: null, value: "" });
|
setRoadmapEdit({ roadmapId: null, field: null, value: "" });
|
||||||
|
|||||||
@@ -666,6 +666,26 @@ describe("RoadmapsView", () => {
|
|||||||
const editButtons = screen.queryAllByRole("button", { name: /edit/i });
|
const editButtons = screen.queryAllByRole("button", { name: /edit/i });
|
||||||
expect(editButtons.length).toBeGreaterThan(0);
|
expect(editButtons.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("sidebar edit pencil selects the roadmap and shows inline edit", async () => {
|
||||||
|
render(<RoadmapsView addToast={mockAddToast} />);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Q2 Roadmap")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
// No roadmap selected yet — main content shows empty state
|
||||||
|
expect(screen.getByText("Select a roadmap from the sidebar to view its milestones.")).toBeInTheDocument();
|
||||||
|
|
||||||
|
// Click the edit pencil on RM-001 in the sidebar
|
||||||
|
const editBtn = screen.getByTestId("roadmap-edit-RM-001");
|
||||||
|
fireEvent.click(editBtn);
|
||||||
|
|
||||||
|
// Roadmap should be selected and inline edit should appear
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByTestId("roadmap-title-input")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Mobile roadmap controls", () => {
|
describe("Mobile roadmap controls", () => {
|
||||||
@@ -843,5 +863,23 @@ describe("RoadmapsView", () => {
|
|||||||
expect(screen.getByTestId("mobile-header-delete-btn")).toBeInTheDocument();
|
expect(screen.getByTestId("mobile-header-delete-btn")).toBeInTheDocument();
|
||||||
expect(screen.getByTestId("mobile-back-btn")).toBeInTheDocument();
|
expect(screen.getByTestId("mobile-back-btn")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("mobile edit pencil selects the roadmap and shows inline edit", async () => {
|
||||||
|
render(<RoadmapsView addToast={mockAddToast} />);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByTestId("mobile-roadmap-item-RM-001")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click the edit pencil on RM-001 in mobile list
|
||||||
|
const editBtn = screen.getByTestId("mobile-roadmap-edit-RM-001");
|
||||||
|
fireEvent.click(editBtn);
|
||||||
|
|
||||||
|
// Should show the mobile header (roadmap selected) and inline edit
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByTestId("roadmaps-view__mobile-header")).toBeInTheDocument();
|
||||||
|
expect(screen.getByTestId("roadmap-title-input")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user