aglinxinyuan opened a new issue, #7353:
URL: https://github.com/apache/texera/issues/7353

   ### Task Summary
   
   Every toolbar action in the description editor — bold, link, and the rest — 
routes through `MarkdownDescriptionComponent.insert`, and it is the one method 
in the component with no coverage (the spec has 15 tests, none touching it).
   
   `insert` splices the action's prefix and suffix around the current textarea 
selection:
   
   ```ts
   const selectedText = this.editingContent.substring(selectionStart, 
selectionEnd) || action.default;
   const textBefore = this.editingContent.substring(0, selectionStart);
   const textAfter = this.editingContent.substring(selectionEnd);
   this.editingContent = textBefore + action.prefix + selectedText + 
action.suffix + textAfter;
   ```
   
   Wrong offsets silently corrupt the text the toolbar is meant to format, so 
this is worth real assertions rather than a smoke test. Cases that matter: a 
selection is wrapped with the surrounding text intact; a collapsed caret 
inserts the action's placeholder instead; the action's own **suffix** is used 
rather than a second copy of the prefix (a link action is asymmetric, so a 
symmetric wrap passes a bold test but breaks links); and the preview re-renders 
from the spliced text.
   
   Two lifecycle details will cost a debugging round if not known up front:
   
   - The fixture needs **two** change-detection cycles. `ngOnInit` forces 
preview mode, so an edit mode set before the first `detectChanges()` is 
silently overwritten and the `@ViewChild("textarea")` never resolves.
   - Do not `await fixture.whenStable()` after calling `insert`. It schedules a 
`requestAnimationFrame` to refocus the textarea, which leaves the zone 
permanently unstable and hangs the test. `renderMarkdown` resolves through a 
promise, so draining the microtask queue is sufficient and terminating.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   
   


-- 
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