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

   ### What changes were proposed in this PR?
   
   The existing tests call `onClickOpenFileSelectionModal` directly, so the 
template
   had never been rendered — it sat at 1/10 statements. Adds 6 tests that 
render it in
   each state it switches on, taking `dataset-file-selector.component.html` to 
10/10
   with no uncovered branches (and the class to 16/16, its last branch being the
   component's own instantiation).
   
   - **enabled, with a path** — the path is shown and the Select File button is 
offered.
   - **enabled, no path yet** — the input is withheld until there is something 
to show;
     only the button renders.
   - **disabled** — no picker to write the path, so the empty input is shown 
instead and
     the button is gone.
   - **the button** — clicking it opens the selection modal; triggering it 
while the flag
     is off does not, which is what the handler's own `isFileSelectionEnabled 
&&` guard is
     for (the `*ngIf` normally removes the button, so the test disables the 
flag without
     re-rendering to reach that guard).
   
   The GUI-config double moved from an inline provider literal to a variable so 
a test
   can flip `selectingFilesFromDatasetsEnabled`; its default is unchanged. No 
production
   code was changed.
   
   **One test pins a defect rather than the intent.** 
`[readOnly]="isFileSelectionEnabled"`
   does not make the input read-only: the camelCase name misses 
`NzInputDirective`'s
   `readonly` input, so it lands on the DOM property, and the directive's
   `[attr.readonly]="readonly() || null"` host binding then clears the 
attribute and
   resets the property. Verified both ways locally — with `[readOnly]` the 
rendered input
   reports `readOnly: false, attr: null`; renaming it to `[readonly]` gives
   `readOnly: true, attr: true`. So the path the picker is meant to own can 
currently be
   typed over. The test asserts the real behaviour with a comment saying what 
to flip when
   the one-word fix lands; the fix itself is a production change and out of 
scope for a
   coverage PR.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7466.
   
   ### How was this PR tested?
   
   `ng test --watch=false --include 
src/app/workspace/component/dataset-file-selector/dataset-file-selector.component.spec.ts`
   — 11 passed (5 existing + 6 new), run 3x for determinism. Coverage 
(`--coverage`)
   confirms `dataset-file-selector.component.html` at 10/10 statements with no 
uncovered
   branches. The failure path was verified by breaking an assertion (red, 
non-zero exit);
   eslint and prettier are 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