Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 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

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

Description

Migrates atomic-timeframe from Stencil to Lit as part of the framework modernization effort. This is a light DOM data container component with no rendering logic or controller integration.

Changes Made

Component Migration

  • Converted to Lit using LightDomMixin(LitElement) with @property decorators
  • Implements Timeframe interface and LitElementWithError
  • Properties: period, unit, amount, label (all reflected to attributes)
  • Validation: Added Bueno schema validation (private static readonly) with ValidatePropsController
  • Error Handling: Added error state property and validation that logs to console only
  • Original Stencil file deleted: Removed atomic-timeframe.tsx

Testing

  • Comprehensive unit tests (17 active tests + 4 skipped for v4)
  • Validation tests: Using it.each and it.skip.each patterns from atomic-result-list.spec.ts
  • Tests validation warnings: Verifies console warnings are logged for invalid prop values
  • Tests all valid units: minute, hour, day, week, month, quarter, year
  • Attribute reflection tests: Verifies all properties reflect to attributes
  • Flattened describe blocks: Following tests-atomic.instructions.md conventions
  • Simplified test patterns: Tests create elements with desired props directly following established codebase patterns

Documentation

  • MDX documentation with usage examples (basic timeframes, custom amounts, future timeframes)
  • Improved JSDoc comments: Clearer, more concise descriptions throughout
  • Storybook stories with MSW mocking: Updated stories to use MockSearchApi for network call mocking
    • Added multiple story variants (WithPastPeriod, WithNextPeriod, MultipleTimeframes)
    • Moved decorator to meta-level for consistency
    • Follows pattern from atomic-sort-expression.new.stories.tsx

Exports

  • Updated index.ts and lazy-index.ts for Lit component loading

Usage

<atomic-timeframe-facet field="date">
  <atomic-timeframe unit="day" amount="7" label="Last week"></atomic-timeframe>
  <atomic-timeframe unit="month" amount="3" label="Last quarter"></atomic-timeframe>
  <atomic-timeframe period="next" unit="week" label="Next week"></atomic-timeframe>
</atomic-timeframe-facet>

Notes

This component is a data container with no rendering logic or controller integration. E2E testing is handled through parent facet components (atomic-timeframe-facet, etc.). No component-specific Cypress tests exist for this component.

Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate atomic-timeframe</issue_title>
<issue_description>Type: User Story
Status: New
Priority: Medium
Components: Atomic

Jira Ticket

KIT-5321</issue_description>

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

Custom agent used: StencilToLitMigrationV1
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 changed the title [WIP] Migrate atomic timeframe implementation feat(atomic): migrate atomic-timeframe to Lit Dec 12, 2025
Copilot AI requested a review from fbeaudoincoveo December 12, 2025 15:01
Copilot AI temporarily deployed to Prerelease (CDN) December 15, 2025 15:28 Inactive
- Delete original Stencil atomic-timeframe.tsx file
- Add LitElementWithError implementation with error state property
- Add constructor with Bueno schema validation (as private static readonly)
- Pass false to ValidatePropsController to only log validation errors
- Flatten nested describe blocks in tests per testing conventions
- Add skipped validation tests with KIT-5197 TODOs

Co-authored-by: fbeaudoincoveo <[email protected]>
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 successfully migrates atomic-timeframe from Stencil to Lit as part of the framework modernization effort. The component is a light DOM data container that defines timeframe configurations for timeframe facet components. The migration follows established patterns for Lit components while preserving all functionality and adding comprehensive tests and documentation.

Key Changes

  • Component rewrite: Complete conversion from Stencil .tsx to Lit .ts using LightDomMixin(LitElement) with property decorators and Bueno validation
  • Test suite addition: New comprehensive unit test suite with 17 active tests covering property validation, attribute reflection, and error handling
  • Storybook enhancement: Updated stories with MSW mocking for realistic facet integration examples, plus comprehensive MDX documentation

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/atomic/src/components/common/atomic-timeframe/atomic-timeframe.tsx Deleted original Stencil component implementation
packages/atomic/src/components/common/atomic-timeframe/atomic-timeframe.ts New Lit implementation with property validation using ValidatePropsController
packages/atomic/src/components/common/atomic-timeframe/atomic-timeframe.spec.ts New comprehensive unit test suite with property, validation, and attribute reflection tests
packages/atomic/src/components/common/atomic-timeframe/atomic-timeframe.new.stories.tsx Enhanced stories with MSW mocking and multiple story variants (past/next periods, custom labels)
packages/atomic/src/components/common/atomic-timeframe/atomic-timeframe.mdx New documentation with usage examples and related component links
packages/atomic/src/components/common/index.ts Added export for Lit component
packages/atomic/src/components/common/lazy-index.ts Added lazy loading entry for component
packages/atomic/src/utils/custom-element-tags.ts Registered component tag in custom element set
packages/atomic/src/components.d.ts Removed Stencil-generated type definitions (now handled by Lit)
packages/atomic-react/src/components/search/components.ts Added React wrapper for search interfaces
packages/atomic-react/src/components/commerce/components.ts Added React wrapper for commerce interfaces

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… value

Apply bot suggestion to create element with period='past' directly rather than modifying post-render, following the established pattern of creating elements with desired props.

Co-authored-by: fbeaudoincoveo <[email protected]>
Copilot AI temporarily deployed to Prerelease (CDN) December 17, 2025 19:09 Inactive
@fbeaudoincoveo fbeaudoincoveo added this pull request to the merge queue Dec 17, 2025
Merged via the queue into main with commit 6e3cefb Dec 17, 2025
98 checks passed
@fbeaudoincoveo fbeaudoincoveo deleted the copilot/migrate-atomic-timeframe branch December 17, 2025 19:34
watallah pushed a commit that referenced this pull request Dec 18, 2025
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: fbeaudoincoveo <[email protected]>
Co-authored-by: Frederic Beaudoin <[email protected]>
Co-authored-by: developer-experience-bot[bot] <91079284+developer-experience-bot[bot]@users.noreply.github.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.

Migrate atomic-timeframe

3 participants