Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

βœ… Checklist

  • πŸ§ͺ The component is unit tested
  • πŸ§ͺ The component includes E2E tests
  • πŸ—‘οΈ Old Cypress tests exclusive to the component are removed
  • πŸ“– The component is documented in storybook with an .mdx file
  • β™Ώ The component complies with the Web Content Accessibility Guidelines.
  • 🌐 All strings intended for humans or assistive technology must be localized with i18n.
  • πŸ“¦ The Lit component is exported in the appropriate index.ts and lazy-index.ts files.
  • 🎨 CSS parts are documented still accessible.
  • πŸ¦₯ Slotted Content, public methods and properties are documented
  • πŸ”„ The component outputs the same Angular output as before with Stencil
  • 🏷️ The component declares the component type in the HTMLElementTagNameMap

Description

This PR migrates the atomic-search-box component from Stencil to Lit framework, following the same patterns used in atomic-commerce-search-box.

Component Migration

Converted from Stencil to Lit:

  • βœ… Deleted old Stencil component file (atomic-search-box.tsx)
  • βœ… Changed @Component to @customElement decorator
  • βœ… Extended LitElement instead of implementing Stencil component
  • βœ… Converted @Prop to @property with proper configuration
  • βœ… Converted @State to @state
  • βœ… Converted @Event to standard CustomEvent dispatching
  • βœ… Converted @Listen to addEventListener in connectedCallback
  • βœ… Converted @AriaLiveRegion to AriaLiveRegionController
  • βœ… Converted @BindStateToController to @bindStateToController decorator
  • βœ… Used @bindings() decorator for bindings initialization
  • βœ… Used @withTailwindStyles decorator
  • βœ… Added @bindingGuard() and @errorGuard() decorators on render
  • βœ… Converted lifecycle methods (componentWillUpdate β†’ willUpdate)
  • βœ… Converted JSX templates to Lit html`` templates
  • βœ… Used Lit directives (classMap, ref)
  • βœ… Used functional components with double invocation pattern
  • βœ… All imports use @/* path aliases
  • βœ… Added global HTMLElementTagNameMap declaration
  • βœ… Exported in index.ts and lazy-index.ts

Unit Tests

Comprehensive Vitest test coverage:

  • βœ… Component initialization and controller setup (both regular and standalone modes)
  • βœ… Props validation (redirectionUrl, disableSearch, minimumQueryLength, numberOfQueries, clearFilters, enableQuerySyntax)
  • βœ… Rendering (spacer, wrapper, textArea, suggestions, clear/submit buttons)
  • βœ… Event listeners (register, focusout)
  • βœ… Accessibility (ARIA labels, screen reader announcements)
  • βœ… User interactions (focus, clear, submit)
  • βœ… State management (disabled states, suggestions display)

Test Fixtures Created:

  • βœ… buildFakeSearchBox - Mock search box controller
  • βœ… buildFakeStandaloneSearchBox - Mock standalone search box controller
  • βœ… fake-atomic-search-box-suggestions - Test component for suggestions

Storybook Stories

Created comprehensive stories with MSW API mocking:

  • βœ… Default - Basic search box
  • βœ… RichSearchBox - With suggestions, recent queries and instant results
  • βœ… StandaloneSearchBox - Redirects to search results page
  • βœ… WithSuggestions - Custom mocked suggestions (5 items)
  • βœ… WithSuggestionsAndRecentQueries - Mocked suggestions (10 items) + localStorage recent queries
  • βœ… WithNoSuggestions - Empty state testing

E2E Tests

  • βœ… Updated page-object to use lit-base-page-object instead of Stencil base-page-object
  • βœ… Existing Playwright E2E tests maintained for happy path and accessibility coverage

Documentation

Created MDX documentation following commerce pattern:

  • βœ… Component description and placement within atomic-search-interface
  • βœ… Usage examples for default child components (recent-queries, query-suggestions)
  • βœ… Configuration examples for instant results
  • βœ… Standalone search box documentation with redirection usage

Quality Verification

  • βœ… Linting passes
  • βœ… Build succeeds
  • βœ… All functionality preserved from Stencil version
  • βœ… Accessibility maintained (WCAG 2.2)
  • βœ… All Lit functional component dependencies exist (search-box-wrapper, search-text-area, submit-button, suggestion-manager)

Fixes #6527

Original prompt

This section details on the original issue you should resolve

<issue_title>[DXUI]: Migrate atomic-search-box</issue_title>
<issue_description>### Task Description

We need to migrate the Atomic-Search-Box to Lit

Acceptance Criteria

  • The Atomic-Search-Box is using Lit exclusivel-ish (there is a suggestion binding for Stencil that needs to stays till v4)

Technical Notes

No response

Jira Ticket

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: stencil-to-lit-migration-agent
Specialized agent for migrating Atomic Stencil code to Lit (components, functional components, and utils)


πŸ’¬ We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 20, 2025 13:58
- Created test fixtures for search box controllers
- Added test helper for fake search box suggestions
- Comprehensive test coverage for props, controller integration, keyboard navigation, and accessibility

Co-authored-by: alexprudhomme <[email protected]>
Copy link
Contributor

@alexprudhomme alexprudhomme left a comment

Choose a reason for hiding this comment

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

@copilot You are missing quite a few things :

  1. You must delete the old stencil component
  2. You must add/adjust the stories file
  3. You must add/adjust the mdx file
  4. You must add/adjust the e2e tests

Use the commerce search box as an example for all of those. Thanks

…ile, add MDX docs, update stories and E2E

- Deleted old Stencil component file (atomic-search-box.tsx)
- Created MDX documentation following commerce pattern
- Updated stories with MSW API mocking (WithSuggestions, WithSuggestionsAndRecentQueries, WithNoSuggestions, StandaloneSearchBox)
- Updated E2E page-object to use lit-base-page-object instead of base-page-object

Co-authored-by: alexprudhomme <[email protected]>
Copy link
Contributor Author

Copilot AI commented Nov 24, 2025

@copilot You are missing quite a few things :

  1. You must delete the old stencil component...

All requested changes have been completed in commit c0006bd:

  1. βœ… Deleted the old Stencil component (atomic-search-box.tsx)
  2. βœ… Updated the stories file with MSW API mocking - added 6 stories including Default, RichSearchBox, StandaloneSearchBox, WithSuggestions, WithSuggestionsAndRecentQueries, and WithNoSuggestions
  3. βœ… Added MDX documentation file following the commerce search box pattern
  4. βœ… Updated E2E page-object to use lit-base-page-object instead of the Stencil base

All changes follow the atomic-commerce-search-box pattern as the reference.

Copilot AI changed the title [WIP] Migrate atomic-search-box to Lit Migrate atomic-search-box to Lit Nov 24, 2025
Copilot AI requested a review from alexprudhomme November 24, 2025 13:06
Copilot finished work on behalf of alexprudhomme November 24, 2025 13:06
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.

[DXUI]: Migrate atomic-search-box

2 participants