mengw15 opened a new pull request, #7655:
URL: https://github.com/apache/texera/pull/7655
### What changes were proposed in this PR?
Renders the two templates and drives their controls through the DOM. 16 new
tests.
| template | statements | branches |
| --- | --- | --- |
| `user-dataset-version-filetree.component.html` | 6/28 -> **28/28** | 0/4
-> **4/4** |
| `admin-user.component.html` | 187/238 -> **229/238** | 4/26 -> 14/26 |
**UserDatasetVersionFiletreeComponent** — the node template was entirely
unrendered.
Covered: the folder-vs-file icon for each node kind and the row label; the
delete action,
which is offered on files but never on the folders holding them, and not at
all when the
tree is not deletable; and Set-as-cover, offered only on image files. Both
actions are
clicked through the DOM and assert the emitted node.
Two constraints shaped these:
- With `useVirtualScroll` on there are no rows under jsdom — the viewport
measures 0 high,
as this component's browser-mode companion spec already records. Browser
mode does not
help: CI uploads coverage from the jsdom run only (`test:ci` -> lcov) and
takes just the
JUnit file from `gui:test-browser`. The block therefore switches
virtualization off,
which changes how many rows the tree draws but not what a row contains.
- The tests are deliberately synchronous. The tree leaves a pending timer,
so awaiting
`whenStable()` never settles; two change-detection passes are what the
rows need.
**AdminUserComponent** — covered: click-to-edit on the name, email and
comment cells
(the cell swaps for its input, typing writes through `ngModel`, Enter
commits and any other
key does not, and clicking away commits too); the role select's
`ngModelChange`; the quota
and feedback row actions, including the feedback button disabled for a user
with none; the
creation-date cell in both its arms; and the Add button.
Per the issue the date is rendered but its formatted value is not asserted —
only that the
cell is non-empty for a user with a creation time and shows the dash for one
without.
No production code was changed.
### Coverage that is not reachable here
- `admin-user.component.html` lines 126/134/151/159/176/184 — the Search and
Reset buttons
of the three column filters, plus the six `[(...)]` writebacks tied to
them. Their markup
lives in `nz-dropdown-menu`, which ng-zorro only renders into the CDK
overlay once the
filter opens, and under jsdom nothing bounded opens it: setting the bound
`nzVisible`
flag, clicking the trigger, calling the trigger's `show()` followed by
synchronous change
detection, a microtask, a single macrotask, and `fakeAsync` + `tick` all
leave the menu
unrendered. It appears only after an unbounded wait, which would mean
guessing a duration
— the flake this repo's specs are careful to avoid.
`searchByName/Email/Comment` and
`reset` themselves are already covered directly by the existing tests.
- One statement on each of lines 217/237/260 — the generated return path of
`(keydown.enter)="saveEdit()"`, which a `void` handler never takes.
Driving a non-Enter
key does not reach it either.
### One small defect worth recording
The email column's search input is labelled `placeholder="Search name"`
(`admin-user.component.html:148`), copied from the name column; the comment
column has its
own label. Left alone here since this PR changes no production code.
### Any related issues, documentation, discussions?
Closes #7651.
### How was this PR tested?
`ng test --watch=false` over the two specs — 65 passed (49 existing + 16
new), run 3x for
determinism. Coverage (`--coverage`) gives the table above. The failure path
was verified by
breaking one assertion in each spec (red, non-zero exit) and restoring them.
`yarn --cwd frontend format:ci`, the repo's own lint step, is clean.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]