fix(browser): text tool, delete API headers, exhaustive Playwright tool tests

- Fix text tool: call updatePreview before confirmDraw so element is created
- Fix all DELETE requests: send Authorization only, no Content-Type body-less requests caused 400
- Add exhaustive Playwright test covering all 30 CAD tools on the actual canvas
- Verified: backend unit tests 254/254, frontend unit tests 380/380, browser tool tests 30/30
This commit is contained in:
2026-07-27 02:02:35 +02:00
parent c86b5e7031
commit 7f8695456c
3 changed files with 281 additions and 9 deletions
+1
View File
@@ -593,6 +593,7 @@ export class InteractionEngine {
// Text: single click placement, then prompt for text content
if (this.state.activeTool === 'text') {
this.updatePreview(pt);
this.confirmDraw();
return;
}
+9 -9
View File
@@ -104,7 +104,7 @@ export async function createProject(token: string, name: string, description?: s
export async function deleteProject(token: string, id: string): Promise<void> {
await fetch(`${API_BASE}/api/projects/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}
@@ -156,7 +156,7 @@ export async function renameProjectFolder(token: string, id: string, name: strin
export async function deleteProjectFolder(token: string, id: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/project-folders/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
if (!res.ok) throw new Error('Failed to delete project folder');
}
@@ -227,7 +227,7 @@ export async function updateElement(token: string, elementId: string, patch: Par
export async function deleteElement(token: string, elementId: string): Promise<void> {
await fetch(`${API_BASE}/api/elements/${elementId}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}
@@ -261,7 +261,7 @@ export async function updateLayer(token: string, layerId: string, patch: Partial
export async function deleteLayer(token: string, layerId: string): Promise<void> {
await fetch(`${API_BASE}/api/layers/${layerId}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}
@@ -295,7 +295,7 @@ export async function updateBlock(token: string, blockId: string, patch: Partial
export async function deleteBlock(token: string, blockId: string): Promise<void> {
await fetch(`${API_BASE}/api/blocks/${blockId}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}
@@ -537,7 +537,7 @@ export async function markNotificationRead(token: string, id: string): Promise<v
export async function deleteNotification(token: string, id: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/notifications/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
if (!res.ok) throw new Error('Failed to delete notification');
}
@@ -572,7 +572,7 @@ export async function createProjectShare(token: string, projectId: string, data:
export async function deleteProjectShare(token: string, shareId: string): Promise<void> {
const res = await fetch(`${API_BASE}/api/shares/${shareId}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
if (!res.ok) throw new Error('Failed to delete share');
}
@@ -644,7 +644,7 @@ export async function renameGlobalFolder(token: string, id: string, name: string
export async function deleteGlobalFolder(token: string, id: string): Promise<void> {
await fetch(`${API_BASE}/api/global-folders/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}
@@ -696,7 +696,7 @@ export async function renameGlobalBlock(token: string, id: string, name: string)
export async function deleteGlobalBlock(token: string, id: string): Promise<void> {
await fetch(`${API_BASE}/api/global-blocks/${id}`, {
method: 'DELETE',
headers: authHeaders(token),
headers: { Authorization: `Bearer ${token}` },
});
}