Skip to content

Add specs for remaining ui-kit coverage gaps - #657

Open
fpigeonjr wants to merge 2 commits into
masterfrom
gh-633-add-specs-for-remaining-ui-kit-gaps-layout-form-te
Open

Add specs for remaining ui-kit coverage gaps#657
fpigeonjr wants to merge 2 commits into
masterfrom
gh-633-add-specs-for-remaining-ui-kit-gaps-layout-form-te

Conversation

@fpigeonjr

Copy link
Copy Markdown
Contributor

Description

Raises unit-test coverage across the remaining under-covered ui-kit areas outside form-controls, components, and experimental, per the parent coverage epic (#576).

New specs for files with zero prior coverage:

  • type-check-helpers.ts (isString/isObject/isArray/safeTypeOf)
  • dom-helpers.ts (ScrollHelpers — window guard, enable/disable scroll, key handling)
  • form-service.ts (fireSubmit/fireReset event emission)
  • utilities/deprecator (deprecate/render warning + table output)
  • pipes/time-ago (moment-based relative time transform)
  • layout/filter-drawer tree, previously entirely untested: filter-drawer.component, filter-drawer-chip, filter-drawer-item, chip-host directive, dynamic-chips.directive

Extended specs for existing but under-covered files:

  • directives/drag-drop — element drop/dragover/dragend branches (previously only window-level events were covered)
  • directives/stickyadjustStickyPos/isTallestAmongSiblings/resize/getElemDistanceToTop branches
  • elements/button — new-vs-deprecated input fallback getters, theme class, disabled-click no-op, debug() deprecation path
  • filters/filters.componentngOnChanges service-integration branch
  • layout/toolbar/aside-toggle — sidenav toggle + SamPageNextService message branches
  • layout/pageSamPageSidebarComponent
  • layout/filters-wrapper — run/reset report behavior with and without SamPageNextService
  • form-templates/phone-entryvalidatePhoneNumber validator branches, form-service submit/reset paths

Coverage improved: statements 53.56% → 56.42%, branches 39.77% → 42.23%, functions 50.31% → 54.22%, lines 52.84% → 55.75%. coverage-floor.json is intentionally left untouched — raising the ratchet is a separate, deliberate coverage:bump commit per repo convention (see AGENTS.md).

Motivation and Context

Closes #633

Type of Change (Select One and Apply Label)

  • Bug fix (non-breaking change which fixes an issue) → Apply bugfix label
  • New feature (non-breaking change which adds functionality) → Apply enhancement label
  • Breaking change (fix or feature that would cause existing functionality to change) → Apply breaking label
  • Documentation / configuration update → Apply maintenance label

How to Test

  1. npm ci && npm ci --prefix test-app
  2. npm --prefix test-app test — confirm all 116 spec files / 746 tests pass
  3. npm run coverage:check — confirm the ratcheting coverage floor gate passes
  4. npm run lint:baseline / npm --prefix test-app run lint:baseline — confirm no new warnings beyond baseline (net -12 warnings vs. baseline in this PR) and no errors
  5. npm run format:check — confirm Prettier formatting passes
  6. cd test-app && npm run build — confirm the build still succeeds

Expected result: All specs pass, coverage gate passes with improved percentages, lint/format gates pass, build succeeds.

Screenshots (if appropriate)

N/A — test-only changes, no UI/behavioral changes.

Checklist

  • Branch name follows convention (e.g. gh-<number>-<slug>)
  • PR title starts with a verb in the imperative mood
  • I have self-reviewed my own code
  • format:check passes (npm run format:check)
  • lint passes (npm run lint)
  • build passes (cd test-app && npm run build)
  • Tests pass and coverage is reported (cd test-app && npm test)
  • If this change requires a documentation update, I have updated it accordingly
  • If there are dependent changes, they have been merged and published in downstream modules

Adds/extends unit specs across layout, directives, elements, filters,
form-templates, wrappers, pipes, and standalone utility/service files
that were under-covered per #633:

- New specs: type-check-helpers, dom-helpers (ScrollHelpers),
  form-service, utilities/deprecator, pipes/time-ago, and the
  previously-untested layout/filter-drawer tree (filter-drawer,
  filter-drawer-chip, filter-drawer-item, chip-host, dynamic-chips).
- Extended specs: directives/drag-drop (element drop/dragover/dragend
  branches), directives/sticky (adjustStickyPos/isTallestAmongSiblings
  branches), elements/button (input fallbacks, theme, disabled click,
  debug() deprecation path), filters (ngOnChanges service branch),
  layout/toolbar/aside-toggle (sidenav + SamPageNextService branches),
  layout/page (SamPageSidebarComponent), layout/filters-wrapper
  (run/reset report with and without SamPageNextService), and
  form-templates/phone-entry (validatePhoneNumber, form-service
  submit/reset paths).

Coverage: statements 53.56% -> 56.42%, branches 39.77% -> 42.23%,
functions 50.31% -> 54.22%, lines 52.84% -> 55.75% (coverage-floor.json
left untouched per repo convention; raising the floor is a separate
coverage:bump commit).

Closes #633
@fpigeonjr fpigeonjr added the maintenance Repo maintenance / tooling label Aug 28, 2026
@fpigeonjr fpigeonjr self-assigned this Aug 28, 2026
@fpigeonjr
fpigeonjr requested a lite review from Copilot August 28, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown

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 increases unit-test coverage across remaining under-covered src/ui-kit areas by adding new spec files for previously untested helpers/utilities/pipes and extending existing specs for several directives, layout components, elements, filters, and form templates.

Changes:

  • Added new specs for previously uncovered modules (e.g., deprecator, type-check helpers, DOM helpers, form service, time-ago pipe, filter-drawer tree).
  • Extended existing specs to cover additional branches and service-integration paths (e.g., sticky, drag-drop, filters wrapper, phone entry, aside toggle, button, filters).
  • Kept coverage-floor.json unchanged per the repo’s ratcheting-floor convention while improving overall measured coverage.

Reviewed changes

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

Show a summary per file
File Description
src/ui-kit/utilities/deprecator/deprecator.spec.ts Adds unit tests for deprecation warning/table rendering behavior.
src/ui-kit/type-check-helpers.spec.ts Adds unit tests for isString/isObject/isArray/safeTypeOf.
src/ui-kit/pipes/time-ago/time-ago.pipe.spec.ts Adds unit test for moment-based relative time transform.
src/ui-kit/layout/toolbar/aside-toggle.spec.ts Extends coverage for sidenav toggling and SamPageNextService message handling.
src/ui-kit/layout/page/pagination.component.spec.ts Extends coverage to include SamPageSidebarComponent initialization behavior.
src/ui-kit/layout/filters-wrapper/filter-wrapper.spec.ts Extends coverage for run/reset behavior with and without SamPageNextService.
src/ui-kit/layout/filter-drawer/filter-drawer.spec.ts Adds tests for Clear All visibility logic and clear event emission.
src/ui-kit/layout/filter-drawer/filter-drawer-item/filter-drawer-item.component.spec.ts Adds tests for item rendering and remove event payload shape.
src/ui-kit/layout/filter-drawer/filter-drawer-chip/filter-drawer-chip.component.spec.ts Adds tests for chip rendering, disabled behavior, and remove emission.
src/ui-kit/layout/filter-drawer/dynamic-chips/dynamic-chips.directive.spec.ts Adds tests for directive-driven chip rendering/removal/disabled behavior.
src/ui-kit/layout/filter-drawer/chip-host/chip-host.directive.spec.ts Adds test that the directive exposes a usable ViewContainerRef.
src/ui-kit/form-templates/phone-entry/phone-entry.spec.ts Extends tests for validation branches and form-service submit/reset integration.
src/ui-kit/form-service.spec.ts Adds tests verifying submit/reset event emission behavior.
src/ui-kit/filters/filters.spec.ts Extends tests for ngOnChanges integration with page service filterFields.
src/ui-kit/elements/button/button.spec.ts Extends tests for legacy/new input fallback, theme classes, disabled click no-op, and debug/deprecation path.
src/ui-kit/dom-helpers.spec.ts Adds tests for scroll enable/disable wiring and key handling.
src/ui-kit/directives/sticky/sticky.spec.ts Extends tests for resize/init logic, distance calc, and sticky positioning branches.
src/ui-kit/directives/drag-drop/drag-drop.spec.ts Extends tests for drop/dragover/dragend branches and drag-state transitions.
Suppressed comments (1)

src/ui-kit/directives/sticky/sticky.spec.ts:114

  • This test also uses directive["el"].nativeElement (a private field). Use the DOM element from the fixture instead to keep the spec aligned with the public-API testing goal and reduce coupling to internal implementation details.
  it("getElemDistanceToTop walks offsetParent chain and sums offsetTop", () => {
    const nativeElement = directive["el"].nativeElement;
    expect(directive.getElemDistanceToTop(nativeElement)).toBe(0);


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ui-kit/dom-helpers.spec.ts
Comment thread src/ui-kit/dom-helpers.spec.ts Outdated
Comment thread src/ui-kit/directives/sticky/sticky.spec.ts Outdated
- dom-helpers.spec.ts: restore original window.onwheel/document.onkeydown
  in afterEach so ScrollHelpers specs don't leak global handler state
  into other specs; rename the mismatched arrow-key test.
- sticky.spec.ts: replace private-field access (directive["el"],
  directive["elemWidth"]) with fixture-based DOM lookups and
  observable style assertions, keeping the specs on the public API.
@fpigeonjr
fpigeonjr marked this pull request as ready for review August 28, 2026 18:11
@fpigeonjr
fpigeonjr requested a review from a team as a code owner August 28, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Repo maintenance / tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add specs for remaining ui-kit gaps (layout, form-templates, directives, utilities, wrappers, pipes, elements, filters)

3 participants