design-angular-kit icon indicating copy to clipboard operation
design-angular-kit copied to clipboard

feat(divider): create standalone ItDividerComponent

Open giulio-leone opened this issue 8 months ago • 2 comments

Summary

Closes #606

Extracts the divider logic from ItDropdownItemComponent into a dedicated standalone component ItDividerComponent, making it reusable across any list or dropdown context.

Changes

New component: ItDividerComponent

  • Dual selector: <it-divider> (custom element) and li[itDivider] (attribute on native <li>)
  • Smart host detection: auto-wraps content in <li> only when the host element is not already a <li>, avoiding invalid nested <li> elements
  • Renders <span class="divider">\</span> — fully compatible with Bootstrap Italia's existing CSS
  • Standalone component with OnPush change detection

Integration

  • Exported via public_api.ts for direct imports
  • Added to ItDropdownModule for seamless use alongside dropdown items

Usage examples

<ul>
  <li itDropdownItem>Item 1</li>
  <it-divider></it-divider>
  <li itDropdownItem>Item 2</li>
</ul>

<ul>
  <li itDropdownItem>Item 1</li>
  <li itDivider></li>
  <li itDropdownItem>Item 2</li>
</ul>

Testing

  • 11 new unit tests covering:
    • Custom element selector rendering and <li> wrapping
    • Attribute selector rendering (no nested <li>)
    • Standalone usage outside list context
    • Multiple dividers in a single list (mixed selectors)
  • 120/120 tests passing (109 baseline + 11 new)
  • 0 lint errors, 8 pre-existing warnings
  • Double gate passed (two consecutive clean runs)

⚠️ This reopens #639 which was accidentally closed due to fork deletion.

giulio-leone avatar Mar 25 '26 19:03 giulio-leone

@giulio-leone is attempting to deploy a commit to the dip-trasformazione-digitale Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 25 '26 19:03 vercel[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-angular-kit Ready Ready Preview Mar 27, 2026 3:50pm

Request Review

vercel[bot] avatar Mar 27 '26 15:03 vercel[bot]