Add specs for remaining ui-kit coverage gaps - #657
Open
fpigeonjr wants to merge 2 commits into
Open
Conversation
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
There was a problem hiding this comment.
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.jsonunchanged 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.
- 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
marked this pull request as ready for review
August 28, 2026 18:11
divyabairavarasu
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Raises unit-test coverage across the remaining under-covered
ui-kitareas outsideform-controls,components, andexperimental, 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/fireResetevent emission)utilities/deprecator(deprecate/renderwarning + table output)pipes/time-ago(moment-based relative time transform)layout/filter-drawertree, previously entirely untested:filter-drawer.component,filter-drawer-chip,filter-drawer-item,chip-hostdirective,dynamic-chips.directiveExtended specs for existing but under-covered files:
directives/drag-drop— elementdrop/dragover/dragendbranches (previously only window-level events were covered)directives/sticky—adjustStickyPos/isTallestAmongSiblings/resize/getElemDistanceToTopbrancheselements/button— new-vs-deprecated input fallback getters,themeclass, disabled-click no-op,debug()deprecation pathfilters/filters.component—ngOnChangesservice-integration branchlayout/toolbar/aside-toggle— sidenav toggle +SamPageNextServicemessage brancheslayout/page—SamPageSidebarComponentlayout/filters-wrapper— run/reset report behavior with and withoutSamPageNextServiceform-templates/phone-entry—validatePhoneNumbervalidator branches, form-service submit/reset pathsCoverage improved: statements 53.56% → 56.42%, branches 39.77% → 42.23%, functions 50.31% → 54.22%, lines 52.84% → 55.75%.
coverage-floor.jsonis intentionally left untouched — raising the ratchet is a separate, deliberatecoverage:bumpcommit per repo convention (see AGENTS.md).Motivation and Context
Closes #633
Type of Change (Select One and Apply Label)
bugfixlabelenhancementlabelbreakinglabelmaintenancelabelHow to Test
npm ci && npm ci --prefix test-appnpm --prefix test-app test— confirm all 116 spec files / 746 tests passnpm run coverage:check— confirm the ratcheting coverage floor gate passesnpm 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 errorsnpm run format:check— confirm Prettier formatting passescd test-app && npm run build— confirm the build still succeedsExpected 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
gh-<number>-<slug>)format:checkpasses (npm run format:check)lintpasses (npm run lint)buildpasses (cd test-app && npm run build)cd test-app && npm test)