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

   ### What changes were proposed in this PR?
   
   Adds a behavior-focused Vitest spec for `MarkdownDescriptionComponent`
   
(`frontend/src/app/dashboard/component/user/markdown-description/markdown-description.component.ts`),
   which previously had no spec (~46% coverage).
   
   > Note: issue #6428 lists the path as 
`workspace/component/markdown-description/`;
   > the component actually lives under 
`dashboard/component/user/markdown-description/`.
   
   14 tests (TestBed + `detectChanges()`, `MarkdownService` stubbed, 
`NZ_MODAL_DATA`
   provided only for the modal cases) cover:
   
   - `should create` and render the preview template.
   - The `editable` input toggling the preview-mode Edit action (shown / 
hidden).
   - `ngOnInit` — inline case: starts in `preview`, seeds `editingContent` from 
`description`; modal case: `editable = true`, `currentMode = "edit"`, 
`description` pulled from modal data (and defaulted to `""` when omitted).
   - `ngOnChanges` — refreshes `editingContent` + re-renders on a non-first 
`description` change in preview mode; leaves it untouched under the edit-mode 
guard; ignores the first change.
   - `enterEditMode` — switches to edit mode only when `editable`.
   - `save` — emits `descriptionChange` with the edited content; returns to 
`preview` inline but stays in `edit` when opened in a modal.
   - `cancel` — restores `editingContent` from `description` and returns to 
`preview`.
   - `renderMarkdown` — renders non-empty input and clears on blank input 
without parsing.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6428
   
   ### How was this PR tested?
   
   New unit tests, run locally in `frontend/` (all green; the failure path was
   verified by deliberately breaking an assertion to confirm the suite goes 
red):
   
   ```
   ng test --watch=false --include 
src/app/dashboard/component/user/markdown-description/markdown-description.component.spec.ts
   # Test Files 1 passed (1) | Tests 14 passed (14)
   prettier --write <spec>   # formatted
   eslint  <spec>            # clean
   ```
   
   `MarkdownService.parse` is stubbed and `NZ_MODAL_DATA` is injected via the 
test
   module, so the suite makes no network calls and needs no real markdown config
   (see `frontend/TESTING.md`).
   
   ### 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