Skip to content

feat(divider): create standalone ItDividerComponent#683

Open
giulio-leone wants to merge 2 commits into
italia:mainfrom
giulio-leone:feat/606-divider-component
Open

feat(divider): create standalone ItDividerComponent#683
giulio-leone wants to merge 2 commits into
italia:mainfrom
giulio-leone:feat/606-divider-component

Conversation

@giulio-leone

Copy link
Copy Markdown
Contributor

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 and others added 2 commits March 25, 2026 11:04
Extract the divider logic from ItDropdownItemComponent into a dedicated
standalone component that can be used independently in any list or
dropdown context.

- Dual selector: <it-divider> (custom element) and li[itDivider] (attribute)
- Auto-detects host element: wraps in <li> only when host is not already <li>
- Exported via public_api.ts and ItDropdownModule
- 11 strict unit tests covering both selectors, standalone usage, and multiples

Closes italia#606

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Create complete doc page with element and attribute usage examples,
API tab, and route registration. Shows it-divider element and
li[itDivider] attribute variants inside dropdown menus.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Mar 25, 2026

Copy link
Copy Markdown

@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

vercel Bot commented Mar 27, 2026

Copy link
Copy Markdown

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

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.

[Feat] Creare il componente <it-divider>

1 participant