mengw15 opened a new pull request, #7419:
URL: https://github.com/apache/texera/pull/7419

   ### What changes were proposed in this PR?
   
   Extends the existing `DatasetDetailComponent` spec so the detail view's 
markup
   actually renders, covering template branches that were previously never 
executed
   
(`frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.html`).
   The spec previously drove the class directly and never queried the DOM. No
   production code was changed.
   
   9 tests drive the template through the DOM:
   
   - **Like tag** — likes when logged in, unlikes when already liked, and stays
     inert (with the `disabled` class) when logged out, exercising the
     `(click)="isLogin && toggleLike()"` guard.
   - **Cover image** — the `*ngIf` omits the `<img>` without a cover URL and the
     `[src]` binding renders it when one is present.
   - **Right bar** — both arms of the collapse/restore `*ngIf` pair are clicked.
   - **Settings tab** — the dataset-name `[(ngModel)]` input renders and its 
Save
     button routes to the service; both `nz-switch` toggles are present and 
their
     change handlers reach `updateDatasetPublicity` / 
`updateDatasetDownloadable`.
   - **Contributors** — the `*ngFor` renders the seeded contributor rows.
   
   Three component behaviours the tests had to account for, noted in comments 
so the
   setup isn't mistaken for boilerplate:
   
   - `toggleLike()` early-returns unless `currentUid` is set — the spec's 
existing
     `login()` helper supplies it (the stub user service emits before the 
component
     subscribes).
   - `ngOnInit`'s subscriptions reset fields such as `coverImageUrl`, so the 
helper
     runs one change-detection pass first, then applies the test state, then 
renders.
   - `nz-tabs` only renders the active tab, and the Settings tab is additionally
     behind `*ngIf="userHasWriteAccess()"`, so an `openTab()` helper switches 
tabs
     and the access level is seeded.
   
   Per the issue's determinism constraints: no fake timers are introduced, no
   date/time string is asserted, and no layout or geometry is asserted.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7409
   
   ### How was this PR tested?
   
   Extended unit tests, run locally in `frontend/` (all green; the failure path 
was
   verified by breaking an assertion to confirm the suite goes red):
   
   ```
   ng test --watch=false --include 
src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.spec.ts
   # Test Files 1 passed (1) | Tests 104 passed (104)
   prettier --write <spec>   # clean
   eslint  <spec>            # 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]

Reply via email to