test(text-editor): cover inlineImages validation and imagePasted suppression#4176
test(text-editor): cover inlineImages validation and imagePasted suppression#4176john-traas wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4176/ |
There was a problem hiding this comment.
Pull request overview
Adds follow-up regression coverage for the inlineImages text-editor configuration introduced previously, focusing on runtime validation and event-contract behavior to protect plain-JS consumers and prevent legacy event leakage.
Changes:
- Add component-level unit tests verifying
inlineImages.tagNameruntime validation rejects built-in tag names while still rendering the editor. - Add browser-style integration/e2e tests ensuring
imagePastedfires only wheninlineImagesis not configured, and is suppressed when inline uploads are enabled. - Extend test helpers to pass the
inlineImagesprop through the sharedcreateComponentfactory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/components/text-editor/text-editor.spec.tsx | Adds unit tests for inlineImages.tagName runtime validation and confirms the editor still renders when config is rejected. |
| src/components/text-editor/text-editor.e2e.tsx | Adds paste-flow coverage to assert imagePasted emits only in legacy mode and is suppressed when inlineImages.upload is configured. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Follow-up test coverage for the
inlineImagesconfig (#4150), complementing the unit tests that merged with the feature.What's covered
inlineImages.tagNamevalidation guard (component-level,text-editor.spec.tsx)imgis rejected with a console error and the editor still renders — the runtime guard that protects plain-JS consumers, since a built-in tag name would hijack the sanitizer whitelist rules for that tag.imagePastedsuppression (browser e2e,text-editor.e2e.tsx)inlineImagesis configured, pasting an image file runs the upload lifecycle and the legacyimagePastedevent never fires. This mutual-exclusivity contract previously existed only as a code comment ininserter.ts.inlineImages, the same paste emitsimagePasted— so the suppression assertion cannot pass vacuously.Both suppression outcomes are synchronized on observable effects (the upload spy / the event itself), not sleeps. Mutation-checked: removing the suppressing
returninhandlePastedImagesfails exactly the suppression test.Out of scope: the paste→upload lifecycle tests (
allowPasteImagesgating,imageUploadingChangeaggregation) are planned separately.🤖 Generated with Claude Code