Skip to content

Conversation

thedhanawada
Copy link

Summary

Adds comprehensive tests for the lwc-style component in @lwc/ssr-client-utils package.

Resolves #5272

Test Coverage

  • Registration of lwc-style custom element
  • Error handling for missing style-id and missing style elements
  • First encounter behavior (stylesheet creation and caching)
  • Cache reuse behavior with placeholder element creation
  • Class preservation for hydration compatibility
  • Karma test environment integration

Verification

  • All 11 tests passing
  • Build successful
  • Linting passed
  • Added package to vitest workspace configuration

@thedhanawada thedhanawada requested a review from a team as a code owner August 9, 2025 12:39
Copy link

salesforce-cla bot commented Aug 9, 2025

Thanks for the contribution! Before we can merge this, we need @thedhanawada to sign the Salesforce Inc. Contributor License Agreement.

@thedhanawada
Copy link
Author

CLA signed

@wjhsf
Copy link
Contributor

wjhsf commented Aug 13, 2025

Thanks for the contribution, @thedhanawada! However, this approach does not actually test the things that we need to validate. Rather than mocking every single interface, we need to run in a real browser (i.e. create Karma tests). The tests should validate that when an lwc-style is used, the component gets removed from the page, and that every component that uses an lwc-style inherits the correct styling, while those that do not use the component are unmodified.

@wjhsf wjhsf closed this Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests for @lwc/ssr-client-utils
2 participants