super-productivity/e2e/tests/task-list-basic
Johannes Millan 5f509be014
fix(tasks): make the parent task time pair add up (#9190) (#9245)
* fix(tasks): make the parent task time pair add up (#9190)

A parent task renders "Σ time spent /  time left". Both cells are rounded
down for display, so the partial minute they share was dropped twice and the
pair read a minute short of the work it represents: 2m and 1m sub tasks with
a few seconds tracked showed 2m.

Derive the left cell from the floored pair, so what is on screen adds up to
the rounded down real total for every input. Rounding the left cell up would
fix the reported case too, but reads a minute long once a sub task is done or
over its estimate, because a done sub task's unspent estimate is dropped and
an over-run is clamped to 0 while the spent sum counts both.

Sum the time left from the sub tasks instead of reading the parent's stored
timeEstimate, which holds the same sum but is only refreshed on estimate
edits, done toggles and structural changes - a tracking tick updates the
parent's time spent alone. Reading it would leave the time left standing
still while time is tracked, and make the pair jump by a minute as the time
spent crosses one. The spec pins the sum against the reducer's own output.

Only the task row is affected; the planner and the Today header render the
same value without a paired time spent, so they keep their own rounding.

* refactor(tasks): trim the parent time pair helper (#9190)

Cut the doc comment down to the two constraints that are not obvious from
the code - that the two values stop being complementary once a sub task is
done or over its estimate, and that the stored timeEstimate is not refreshed
by a tracking tick - and drop the sweep from the spec, which the derived rule
makes redundant: the identity holds by construction, so it could only fail on
a formatting break the explicit cases already cover.

Verified the spec still discriminates: reverting to the raw value fails 4,
rounding up fails 4 different ones, the real implementation passes 8.

* test(tasks): cover the parent time pair in the browser (#9190)

Nothing rendered this row: both TaskComponent harnesses blank the template
via overrideComponent, and templates are only type-checked under AOT, so the
computed -> binding -> pipe -> DOM chain had no test behind it.

Short syntax sets time spent and estimate directly ('0.05m/2m' is 3s against
a 2m estimate), so the reported state is reproducible without tracking for
real. Reverting the helper to the pre-fix rounding renders
'functions -/hourglass_empty 2m' and fails this test.

* fix(tasks): narrow the time-left borrow and share the sum (#9190)

A second review round turned up three problems in the previous commits.

The borrowed partial minute made the cell oscillate. Deriving the time left
from the floored pair is only sound while the two cells are two halves of one
total; once a sub task is done or over its estimate the spent sum keeps
counting it while the time left does not, so the borrow flipped the cell up
and down twice per tracked minute - the same defect that ruled out reading the
stored timeEstimate. Restrict it to the complementary case, where it fixes the
reported bug, and fall back to the plain floored remainder otherwise, which is
what that state always displayed.

The time-left sum was duplicated from reCalcTimeEstimateForParentIfParent.
Open PR #8038 rewrites that formula for nested sub tasks and the copy would
have diverged silently, since the two files do not touch. Extract it so both
call one function; the reducer specs that already pin the sum now pin the
display with it.

The isDone term had no test that could fail: every done fixture was also at or
over its estimate, so max(0, ...) already yielded 0. The over-run clamp had the
same hole, exceeded by only 40s and absorbed by the floor.

Fold the e2e into the existing sub task spec, with a fixture whose tracked time
is actually rendered ('1.05m/2m'), so short syntax drifting can no longer turn
it into a vacuous pass. Gate the row on the value it renders.
2026-07-22 19:31:29 +02:00
..
add-subtask-with-detail-panel-open.spec.ts fix(tasks): make "Add subtask" work in the Planner detail panel (#8617) (#8630) 2026-06-29 15:57:44 +02:00
drag-task-into-subtask.spec.ts feat(tasks): allow dragging tasks into subtask lists (#7962) 2026-06-02 19:43:41 +02:00
finish-day-quick-history-with-subtasks.spec.ts test(e2e): stabilize finish day history flow 2026-06-06 19:00:50 +02:00
finish-day-quick-history.spec.ts test(e2e): stabilize finish day history flow 2026-06-06 19:00:50 +02:00
simple-subtask.spec.ts fix(tasks): make the parent task time pair add up (#9190) (#9245) 2026-07-22 19:31:29 +02:00
task-list-start-stop.spec.ts refactor(e2e): replace waitForTimeout with condition-based waits 2026-01-03 15:29:38 +01:00