Skip to content

extend ConsoleFrameComponent template coverage #7329

Description

@mengw15

Task Summary

ConsoleFrameComponent's template is at ~26% (console-frame.component.html, 68 uncovered lines) while its class file console-frame.component.ts is already ~94%. The existing spec drives the component class directly but never renders most of the template, so the bindings and conditional blocks stay unexecuted. Bring the template to full coverage. Vitest/jsdom; see frontend/TESTING.md.

Behavior to add

Extend console-frame.component.spec.ts so the template actually renders each of its branches, then run the coverage report and cover the remaining red lines. The uncovered constructs are *ngIf branches, *ngFor lists, (click) handlers and [(ngModel)] bindings — for example the showTimestamp / showSource display toggles and the message list.

Approach (standard Angular/Vitest):

  • Call fixture.detectChanges() after every state change — it is the template-coverage switch.
  • Drive the bindings through the DOM rather than by calling methods directly: fixture.debugElement.query(By.css("...")) then .triggerEventHandler("click", ...) / set the control value and dispatch input.
  • Seed component state / @Inputs so each *ngIf arm renders (empty vs populated console, error vs normal message, each toggle on and off) and *ngFor expands over a few messages.

Determinism constraints for this component (please follow — CI runs a multi-OS matrix):

  • The message row renders a timestamp through | date : "M-d-yy, HH:mm:ss.SSS" (template L135). Render it, but do not assert the formatted string — a fixed epoch renders a different day/hour under a UTC CI runner. Assert the row exists / other cell text instead, or match a timezone-stable substring.
  • ngAfterViewChecked queues a setTimeout that sets scrollTop = scrollHeight for auto-scroll (component L167). Do not reach for vi.useFakeTimers() just to stop it — a synchronous test body never lets the callback run, and layering fake timers over zone.js's patched setInterval/setTimeout is Node-version dependent and has produced CI-only failures. Leave real timers alone.
  • Do not assert on layout or geometry (scrollHeight, getBoundingClientRect) — they return zeros under jsdom. Assert on rendered text, element presence, and the component state the binding updates.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions