feat: feedback verbetering 02
This commit is contained in:
@@ -242,7 +242,13 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self._extract_js_function(app_js, "activeTasksFromItems"),
|
||||
self._extract_js_function(app_js, "taskIsCancellable"),
|
||||
self._extract_js_function(app_js, "cancelTaskRequest"),
|
||||
self._extract_js_function(app_js, "formatTaskOperationLabel"),
|
||||
self._extract_js_function(app_js, "hasMeaningfulItemProgress"),
|
||||
self._extract_js_function(app_js, "canShowChipItemProgress"),
|
||||
self._extract_js_function(app_js, "compactTaskCurrentItem"),
|
||||
self._extract_js_function(app_js, "activeTaskChipLabel"),
|
||||
self._extract_js_function(app_js, "taskProgressText"),
|
||||
self._extract_js_function(app_js, "taskProgressSubtext"),
|
||||
self._extract_js_function(app_js, "headerTaskRenderKey"),
|
||||
self._extract_js_function(app_js, "shouldPollHeaderTasks"),
|
||||
self._extract_js_function(app_js, "stopHeaderTaskPolling"),
|
||||
@@ -294,6 +300,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
disabled: false,
|
||||
onclick: null,
|
||||
scrollTop: 0,
|
||||
title: "",
|
||||
attributes: {{}},
|
||||
append(...nodes) {{
|
||||
this.children.push(...nodes);
|
||||
@@ -354,7 +361,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
{{ id: "d", operation: "download", status: "preparing", source: "/src/d", destination: "folder.zip" }},
|
||||
{{ id: "dup", operation: "duplicate", status: "queued", source: "/src/dup", destination: "/dst/dup" }},
|
||||
{{ id: "del", operation: "delete", status: "running", source: "/src/del", destination: "" }},
|
||||
{{ id: "stop", operation: "copy", status: "cancelling", source: "/src/stop", destination: "/dst/stop" }},
|
||||
{{ id: "stop", operation: "copy", status: "cancelling", source: "/src/stop", destination: "/dst/stop", done_items: 1, total_items: 4, current_item: "nested/final-file.txt" }},
|
||||
{{ id: "e", operation: "copy", status: "completed", source: "/src/e", destination: "/dst/e" }},
|
||||
{{ id: "f", operation: "move", status: "failed", source: "/src/f", destination: "/dst/f" }},
|
||||
{{ id: "g", operation: "download", status: "ready", source: "/src/g", destination: "folder.zip" }},
|
||||
@@ -366,7 +373,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
assert(activeTasks.every((task) => isActiveTask(task)), "All filtered tasks should be active");
|
||||
assert(activeTasks.some((task) => task.operation === "delete"), "Delete should count once it uses the shared task flow");
|
||||
assert(activeTasks.some((task) => task.status === "cancelling"), "Cancelling tasks should remain visible while stopping");
|
||||
assert(activeTaskChipLabel(activeTasks.length) === "5 active tasks", "Chip label should reflect active task count");
|
||||
assert(activeTaskChipLabel(activeTasks) === "5 active tasks", "Chip label should reflect active task count");
|
||||
|
||||
updateHeaderTaskState(mixedTasks);
|
||||
assert(!elements["header-task-chip-container"].classList.contains("hidden"), "Chip should be visible with active tasks");
|
||||
@@ -378,13 +385,45 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
assert(!elements["header-task-popover"].classList.contains("hidden"), "Popover should be visible when open");
|
||||
assert(elements["header-task-chip-btn"].attributes["aria-expanded"] === "true", "Chip button should expose expanded state");
|
||||
assert(elements["header-task-popover-list"].children.length === 5, "Popover should render only active file-action tasks");
|
||||
const moveRow = elements["header-task-popover-list"].children[1];
|
||||
const moveProgress = moveRow.children[3];
|
||||
const moveCurrent = moveRow.children[4];
|
||||
assert(moveProgress.textContent === "1/3", "Popover should show done/total progress when available");
|
||||
assert(moveCurrent.textContent === "b.mkv", "Popover should show compact current item");
|
||||
const cancellingRow = elements["header-task-popover-list"].children[4];
|
||||
const cancellingProgress = cancellingRow.children[3];
|
||||
const cancellingCurrent = cancellingRow.children[4];
|
||||
const cancellingSubtext = cancellingRow.children[5];
|
||||
assert(cancellingProgress.textContent === "1/4", "Cancelling tasks should keep progress visible");
|
||||
assert(cancellingCurrent.textContent === "nested/final-file.txt", "Cancelling tasks should show current item");
|
||||
assert(cancellingSubtext.textContent === "Stopping after current item...", "Cancelling tasks should explain stop semantics");
|
||||
const firstActionButton = elements["header-task-popover-list"].children[0].children[3].children[0];
|
||||
const cancellingActionButton = elements["header-task-popover-list"].children[4].children[3].children[0];
|
||||
const cancellingActionButton = elements["header-task-popover-list"].children[4].children[6].children[0];
|
||||
assert(firstActionButton.textContent === "Stop", "Queued/running tasks should expose a Stop action");
|
||||
assert(!firstActionButton.disabled, "Queued/running tasks should be cancellable");
|
||||
assert(cancellingActionButton.textContent === "Stopping...", "Cancelling tasks should show stopping state");
|
||||
assert(cancellingActionButton.disabled, "Cancelling tasks should not expose a second stop action");
|
||||
|
||||
updateHeaderTaskState([
|
||||
{{ id: "single-copy", operation: "copy", status: "running", source: "/src/a", destination: "/dst/a", done_items: 7, total_items: 20, current_item: "season1/episode07.mkv" }},
|
||||
]);
|
||||
assert(elements["header-task-chip-label"].textContent === "Copy 7/20", "Single copy task should show compact item progress in chip");
|
||||
|
||||
updateHeaderTaskState([
|
||||
{{ id: "single-dup", operation: "duplicate", status: "running", source: "/src/a", destination: "/dst/a copy", done_items: 3, total_items: 12, current_item: "nested/file.txt" }},
|
||||
]);
|
||||
assert(elements["header-task-chip-label"].textContent === "Duplicate 3/12", "Single duplicate task should show compact item progress in chip");
|
||||
|
||||
updateHeaderTaskState([
|
||||
{{ id: "single-move", operation: "move", status: "running", source: "/src/dir", destination: "/dst/dir", done_items: 0, total_items: 1, current_item: "Folder" }},
|
||||
]);
|
||||
assert(elements["header-task-chip-label"].textContent === "Move running", "Single move task should stay coarse in chip");
|
||||
|
||||
updateHeaderTaskState([
|
||||
{{ id: "single-cancelling", operation: "copy", status: "cancelling", source: "/src/a", destination: "/dst/a", done_items: 2, total_items: 5, current_item: "nested/file.txt" }},
|
||||
]);
|
||||
assert(elements["header-task-chip-label"].textContent === "Copy cancelling", "Single cancelling task should surface cancelling state in chip");
|
||||
|
||||
updateHeaderTaskState([
|
||||
{{ id: "z1", operation: "copy", status: "completed", source: "/src/z1", destination: "/dst/z1" }},
|
||||
{{ id: "z2", operation: "move", status: "failed", source: "/src/z2", destination: "/dst/z2" }},
|
||||
@@ -416,7 +455,13 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self._extract_js_function(app_js, "activeTasksFromItems"),
|
||||
self._extract_js_function(app_js, "taskIsCancellable"),
|
||||
self._extract_js_function(app_js, "cancelTaskRequest"),
|
||||
self._extract_js_function(app_js, "formatTaskOperationLabel"),
|
||||
self._extract_js_function(app_js, "hasMeaningfulItemProgress"),
|
||||
self._extract_js_function(app_js, "canShowChipItemProgress"),
|
||||
self._extract_js_function(app_js, "compactTaskCurrentItem"),
|
||||
self._extract_js_function(app_js, "activeTaskChipLabel"),
|
||||
self._extract_js_function(app_js, "taskProgressText"),
|
||||
self._extract_js_function(app_js, "taskProgressSubtext"),
|
||||
self._extract_js_function(app_js, "headerTaskRenderKey"),
|
||||
self._extract_js_function(app_js, "shouldPollHeaderTasks"),
|
||||
self._extract_js_function(app_js, "stopHeaderTaskPolling"),
|
||||
@@ -527,7 +572,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
{{ id: "copy-1", operation: "copy", status: "running", source: "/src", destination: "/dst" }},
|
||||
]);
|
||||
assert(!elements["header-task-chip-container"].classList.contains("hidden"), "Running task should make chip visible");
|
||||
assert(elements["header-task-chip-label"].textContent === "1 active task", "Chip should show one active task");
|
||||
assert(elements["header-task-chip-label"].textContent === "Copy running", "Single active task should show compact task status");
|
||||
assert(headerTaskState.activeItems.length === 1, "Snapshot should store active task state");
|
||||
|
||||
applyTaskSnapshot([
|
||||
@@ -810,7 +855,13 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertIn('function activeTasksFromItems(items)', app_js)
|
||||
self.assertIn('function taskIsCancellable(task)', app_js)
|
||||
self.assertIn('async function cancelTaskRequest(taskId)', app_js)
|
||||
self.assertIn('function activeTaskChipLabel(count)', app_js)
|
||||
self.assertIn('function formatTaskOperationLabel(task)', app_js)
|
||||
self.assertIn('function hasMeaningfulItemProgress(task)', app_js)
|
||||
self.assertIn('function canShowChipItemProgress(task)', app_js)
|
||||
self.assertIn('function compactTaskCurrentItem(task)', app_js)
|
||||
self.assertIn('function activeTaskChipLabel(items)', app_js)
|
||||
self.assertIn('function taskProgressText(task)', app_js)
|
||||
self.assertIn('function taskProgressSubtext(task)', app_js)
|
||||
self.assertIn('function shouldPollHeaderTasks()', app_js)
|
||||
self.assertIn('function scheduleHeaderTaskPolling()', app_js)
|
||||
self.assertIn('function setHeaderTaskPopoverOpen(nextOpen)', app_js)
|
||||
@@ -819,6 +870,10 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertIn('function updateHeaderTaskState(taskItems)', app_js)
|
||||
self.assertIn('function applyTaskSnapshot(taskItems)', app_js)
|
||||
self.assertIn('return `${count} active task${count === 1 ? "" : "s"}`;', app_js)
|
||||
self.assertIn('return task.operation === "copy" || task.operation === "duplicate";', app_js)
|
||||
self.assertIn('return `${action} ${task.done_items}/${task.total_items}`;', app_js)
|
||||
self.assertIn('return `${action} running`;', app_js)
|
||||
self.assertIn('return "Stopping after current item...";', app_js)
|
||||
self.assertIn('ACTIVE_TASK_OPERATIONS.has(task.operation)', app_js)
|
||||
self.assertIn('headerTaskState.activeItems = activeTasksFromItems(taskItems);', app_js)
|
||||
self.assertIn('const open = Boolean(nextOpen) && headerTaskState.activeItems.length > 0;', app_js)
|
||||
|
||||
Reference in New Issue
Block a user