Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Description

Migrates the FacetSegmentedValue functional component from Stencil to Lit. This is a rendering function used by atomic-segmented-facet, not a standalone web component.

Changes

  • Lit Implementation (facet-segmented-value.ts)

    • Uses FunctionalComponent<FacetValuePropsBase> type signature
    • Replaces Stencil's Button with Lit's renderButton
    • Applies keyed directive for list item stability
    • Maintains existing functionality: segmented button with label and compact count formatting
  • Backward Compatibility

    • Renamed original to stencil-facet-segmented-value.tsx
    • Updated atomic-segmented-facet.tsx import to use prefixed version
    • No breaking changes to existing Stencil components
  • Unit Tests (facet-segmented-value.spec.ts)

    • 21 test cases: rendering, props, ARIA attributes, styling states
    • Uses renderFunctionFixture pattern consistent with other functional component tests
    • Predictable assertions based on stable English locale from createTestI18n()
    • Exact number format expectations (e.g., 1234(1.2K), 987654321(988M))

✅ Checklist

  • 🧪 The component is unit tested
  • 🧪 The component includes E2E tests (N/A - functional component)
  • 🗑️ Old Cypress tests exclusive to the component are removed (N/A - no existing tests)
  • 📖 The component is documented in storybook with an .mdx file (N/A - functional component)
  • ♿ 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 (N/A - internal functional component)
  • 🎨 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 (N/A - functional component)
  • 🏷️ The component declares the component type in the HTMLElementTagNameMap (N/A - functional component)

https://coveord.atlassian.net/browse/KIT-4956

Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate FacetSegmentedValue</issue_title>
<issue_description>

Jira Issue: KIT-4956

Type: User Story
Status: New
Priority: Medium
Components: Atomic


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)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Migrate FacetSegmentedValue component refactor(atomic): migrate FacetSegmentedValue functional component to Lit Nov 14, 2025
Copilot AI requested a review from louis-bompart November 14, 2025 05:00
Copilot finished work on behalf of louis-bompart November 14, 2025 05:00
Copy link
Collaborator

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

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

@copilot some work on the ut, make them more "stable" & reliable.
Do consider also that this is a functionnal component. We Unit Test those: if you need more mocks, go ahead.

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot some work on the ut, make them more "stable" & reliable.
Do consider also that this is a functionnal component. We Unit Test those: if you need more mocks, go ahead.

Done! I've improved the tests to be more stable and reliable:

  1. Predictable assertions: Changed vague checks to exact number format expectations (e.g., (1.2K), (1.2M), (988M)) based on the stable English locale
  2. Added clarity: Added a comment explaining that createTestI18n() provides a stable locale for consistent formatting
  3. Removed redundancy: Removed a duplicate test that was just checking if a list item exists

All tests now have specific, predictable expectations. Commit: 7d87568

Copilot AI requested a review from louis-bompart November 14, 2025 05:16
Copilot finished work on behalf of louis-bompart November 14, 2025 05:16
Copilot AI temporarily deployed to Prerelease (CDN) November 14, 2025 05:47 Inactive
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the FacetSegmentedValue functional component from Stencil to Lit. The component renders segmented facet values with a button, label, and compact count formatting used by atomic-segmented-facet.

Key changes:

  • New Lit implementation using FunctionalComponent<FacetValuePropsBase> type signature
  • Applies keyed directive for list stability and uses renderButton instead of Stencil's Button
  • Comprehensive test suite with 21 test cases covering rendering, props, ARIA attributes, and styling

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
stencil-facet-segmented-value.tsx Renamed original Stencil implementation with deprecation notice for backward compatibility
facet-segmented-value.ts New Lit functional component replacing Stencil version with equivalent functionality
facet-segmented-value.spec.ts New unit tests for Lit component covering rendering, accessibility, and interaction scenarios
atomic-segmented-facet.tsx Updated import to use prefixed Stencil version maintaining backward compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

@fbeaudoincoveo fbeaudoincoveo left a comment

Choose a reason for hiding this comment

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

GG!

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.

Migrate FacetSegmentedValue

5 participants