Skip to content

Conversation

Raghavcr7
Copy link

Summary

  • Set up Vitest + jsdom + Testing Library.
  • Added tests/setupTests.ts with polyfills/mocks:
    • ElementInternals polyfill
    • wa-* element stubs
    • Mocks for theme injector, Hanko, and icons.
  • Added tests/components/header.spec.ts covering:
    • Element registration
    • size="small" class
    • selectTab() logic and guards
    • "tab-change" event detail
    • Login flow (dialog + event).
  • All tests pass locally.

Next steps

  • Add Playwright visual regression setup (starting with ).

Ref: #150

Copy link
Member

@spwoodcock spwoodcock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the input!

How much of this is written by you, and how much is AI generated?
(we do have a policy for LLM code at HOT, but can be flexible if its a mix)

Please be honest 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment for why we need polyfills here? 🙏

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I had added the polyfills and mocks earlier just to test the logic and make sure the Vitest setup was working properly in jsdom.
I meant to remove them afterward and thought I already had, but looks like I missed that.
They’re no longer needed I just reran everything, and the tests pass cleanly without both. I’ll remove them in the next commit to keep things tidy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, just to be transparent I wrote around 80% of the code myself.
I used AI mostly to help debug issues, refine TypeScript configs, and test small snippets

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up! Sounds good =)

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.

2 participants