Skip to content

feat(components/theme,i18n): add test harnesses for theme and i18n libraries#8

Open
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
devin/1768225422-theme-i18n-test-harnesses
Open

feat(components/theme,i18n): add test harnesses for theme and i18n libraries#8
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
devin/1768225422-theme-i18n-test-harnesses

Conversation

@devin-ai-integration
Copy link
Copy Markdown

feat(components/theme,i18n): add test harnesses for theme and i18n libraries

Summary

This PR adds test harnesses for two core infrastructure components that previously lacked testing support:

@skyux/theme/testing - SkyThemeHarness for testing components that use the [skyTheme] directive. Exposes methods to query theme state including getThemeName(), getThemeMode(), getThemeSpacing(), and convenience boolean methods like isModernTheme(), isDarkMode(), etc.

@skyux/i18n/testing - SkyResourcesHarness for testing elements that display localized content. Provides getText(), getInnerHtml(), and getAttribute() methods.

Both harnesses follow established patterns from existing harnesses in the codebase, extending SkyComponentHarness and implementing the standard with() filter method.

Review & Testing Checklist for Human

  • Verify the i18n harness selector - The SkyResourcesHarness uses [skyLibResources],[skyAppResources] as the host selector. Confirm this matches actual usage patterns in consuming applications, as these appear to be pipe names rather than directive selectors.
  • Run the test suites in CI - Tests could not be executed locally due to Chrome unavailability. Verify all tests pass in CI with actual browser execution.
  • Validate theme CSS class detection - The SkyThemeHarness detects theme state by checking CSS classes (sky-theme-modern, sky-theme-mode-dark, sky-theme-modern-compact). Confirm these class names are stable and correctly applied by the theme service.
  • Test harness usage in a real component test - Consider writing a quick integration test using these harnesses against an actual SKY UX component to validate the API works as expected.

Recommended test plan: After CI passes, import SkyThemeHarness and SkyResourcesHarness in an existing component test file and verify they can be instantiated and queried correctly.

Notes

  • Documentation.json files were not updated because the manifest generator requires a specific format with development/testing/codeExamples sections. The harnesses are still exported and usable via the public API.
  • TypeScript compilation verified locally; actual test execution pending CI.

Link to Devin run: https://app.devin.ai/sessions/40159d8b73b6471dbfc064046a58280e
Requested by: @bcmake

…braries

- Add @skyux/theme/testing package with SkyThemeHarness for testing theme directives
- Add @skyux/i18n/testing package with SkyResourcesHarness for testing localized content
- Update tsconfig.base.json with testing package path mappings
- Include comprehensive unit tests for both harnesses

Co-Authored-By: benc@cognition.ai <Benc@windsurf.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Fix formatting issues in test files and tsconfig.base.json
- Add @angular/cdk and @skyux/core as peer dependencies to i18n and theme libraries

Co-Authored-By: benc@cognition.ai <Benc@windsurf.com>
- Remove @skyux/core from i18n peer dependencies to avoid circular dependency
- Restructure i18n harness to extend ComponentHarness directly from @angular/cdk/testing
- Create local implementation of dataSkyId filter to avoid importing from @skyux/core/testing

Co-Authored-By: benc@cognition.ai <Benc@windsurf.com>
- Remove @skyux/core from theme peer dependencies to avoid circular dependency
- Restructure theme harness to extend ComponentHarness directly from @angular/cdk/testing
- Create local implementation of dataSkyId filter to avoid importing from @skyux/core/testing

Co-Authored-By: benc@cognition.ai <Benc@windsurf.com>
Co-Authored-By: benc@cognition.ai <Benc@windsurf.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants