Commit Graph

18 Commits

Author SHA1 Message Date
mehrabix f396e32df9 feat: add provideSpartanHlm utility to fix CDK overlay z-index conflict
In Angular 21, the CDK overlay defaults to using the popover attribute,
which causes overlay-based components (sheets, dialogs, tooltips) to
always render above position: fixed elements like hlm-toaster. This
adds a provideSpartanHlm() utility that configures OVERLAY_DEFAULT_CONFIG
with usePopover: false, and documents the issue in the sonner docs.

Closes #1280
2026-06-17 19:08:20 +03:30
Patrick 803614a7bb test: update overlay api snapshots 2026-06-13 14:48:23 -04:00
Ashley Hunter 1b743f8019 test: migrate from jest to vitest with browser testing for brain/helm
Replace Jest with Vitest across the workspace. The brain and helm Angular suites
now run in a real browser (Playwright/Chromium via Vitest browser mode) so they
exercise real layout, focus, pointer events and computed styles that jsdom could
not. The cli, tools, mcp, registry and cli-smoke suites run on Vitest's node
environment.

- Add per-project vite configs and switch test targets to @nx/vitest:test
- Convert jest APIs to vi.* and jest module mocks to vi.mock with importOriginal
- Replace jest-axe with a browser-native axe-core helper and toHaveNoViolations
- Regenerate snapshots in vitest format (content unchanged, format-only)
- Remove all jest packages, configs, the preset and the @nx/jest target default
- Install Playwright Chromium in the CI unit job for the browser suites

Also fixes a brain avatar test that asserted inside a fire-and-forget setTimeout,
which passed vacuously under jsdom and only surfaced once a real browser loaded
the image.
2026-06-13 15:16:45 +01:00
Ashley Hunter d4da582d40 feat(repo)!: upgrade nx to 22 and angular to 21 (#1430)
* feat(repo)!: upgrade nx to 22 and angular to 21

Upgrade the workspace to Nx 22.7.5 and Angular 21.2.16, and widen the
published peer dependency ranges to support Angular 21 and 22 while
dropping Angular 20.

- nx and @nx/* to 22.7.5; @angular/* to 21.2.16 (framework) and 21.2.14
  (cli, build, devkit, cdk, ssr)
- brain, helm and trpc @angular/* peers to ">=21.0.0 <23.0.0"; the helm
  embla-carousel-angular peer uses the same range
- @spartan-ng/cli minimums raised to >=21 and @schematics/angular to
  21.2.14; the private tools lib aligned to nx 22 / angular 21
- analog 2.6.0, ng-packagr 21, angular-eslint 21, storybook 10, jest 30,
  @testing-library/angular 19 and related tooling
- replace the calendar select host-listener $event with a typed output
  subscription; constrain the ai-chat-link directive to anchors
- drive the menubar e2e arrow keys via native keydown and disable
  Chromium throttling; hold cypress at 14 (15 breaks realPress specs)

BREAKING CHANGE: Angular 20 is no longer supported. spartan/ui now
supports Angular 21 and 22.

* ci: lower unit test parallelism to fit the runner memory

The docs app's vitest + Analog suite peaks at a few GB; running it
alongside two other test projects under --parallel=3 exhausted the
GitHub runner memory and the worker was OOM-killed with no output.
Run at most two test projects concurrently.

* fix(trpc): drop invalid environment providers from the test env module

The Nx 22 migration wrapped provideZoneChangeDetection() in an @NgModule,
but EnvironmentProviders are not valid in @NgModule providers and Angular
21 throws NG0207 at runtime. Restore the plain initTestEnvironment setup
(matching the docs app); the explicit zone provider is unnecessary.

* ci: run the docs app test suite in isolation

Bundling the docs app's vitest + Analog suite into the parallel test run
made it fail in CI while it passes on its own, and the interleaved output
hid the cause. Run the other projects in parallel, then the docs app as a
separate step.

* fix(nx): point test cache inputs at the real jest preset file

The test targets' cache inputs referenced jest.preset.js, but the
workspace preset is jest.preset.cjs, so the input never matched and a
preset change would not invalidate the cache. Fix both the
@nx/vitest:test target (added by the Nx 22 migration) and the existing
@nx/jest:jest target.

* ci: log exit code and retry the docs app test suite once

The docs app's vitest + Analog suite intermittently crashes in CI right
after loading Angular's testing modules, with no error output. Log the
exit code to classify the crash (128+signal indicates a native crash)
and retry once so a flaky crash does not fail the run while the root
cause is investigated.

* ci: clarify docs app test retry after pinpointing the flaky crash

The crash is in app.spec.ts: booting the full app shell (Header/Footer
and their deep import graph) intermittently crashes the vitest worker
during the Analog transform in CI (exit 1, no output, not reproducible
locally). It happens before any test runs, so a vitest per-test retry
cannot help; re-running the suite once does.

* chore(repo): hold analog at 2.1.3 and drop unit-test ci workarounds

Analog 2.6.0 intermittently crashed the docs app's vitest worker in CI
(a flaky transform of the app shell), so keep analog at the nx-migration's
tested 2.1.3, revert the marked bumps that 2.6.0 required, and restore the
ai-chat-link directive selector. Also restore the original unit test ci
step, dropping the parallel, isolation and retry workarounds added while
chasing that crash.
2026-06-08 22:23:45 +02:00
Mitja Kurath 823de631fc test(repo): fix contradictory documentation in classes utility tests (#1334)
Corrects comments and test descriptions in hlm.spec.ts to accurately
reflect that existing/SSR classes take precedence over classes
applied via the utility.

Closes #1222i
2026-04-29 10:54:19 +02:00
moosme fe84a8bc17 Merge pull request #1269 from MerlinMoos/polish-button 2026-03-13 23:50:33 +01:00
Ashley Hunter 0e6385d4e9 Merge pull request #1266 from spartan-ng/class-sorting
fix: suppress CSS transitions during hydration to prevent flicker
2026-03-13 17:58:56 +00:00
Merlin e14d57d80e Merge remote-tracking branch 'origin/main' into polish-button
# Conflicts:
#	libs/cli/src/generators/ui/supported-ui-libraries.json
2026-03-13 11:16:43 +01:00
Ashley Hunter 484117f8da revert: removing ssr attribute 2026-03-12 18:03:02 +00:00
Merlin d3e521c036 feat: add style section 2026-03-12 16:25:34 +01:00
Johannes Homeier e69a4f8853 refactor: use hlm in classes 2026-03-12 12:01:12 +01:00
Ashley Hunter 0a929797b1 refactor: remove redundant SSR transition marker test without transition classes 2026-03-12 00:18:22 +00:00
Ashley Hunter 6607884d56 feat: enhance SSR transition handling and suppression logic 2026-03-11 23:59:05 +00:00
Ashley Hunter e7dc5c32e1 fix: suppress CSS transitions during hydration to prevent flicker
When Angular hydrates SSR-rendered elements, the classes() function rewrites
class attributes which can trigger CSS transition animations. This adds
transition: none !important during initial class application and removes it
via requestAnimationFrame after the browser has painted the correct classes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:09:04 +00:00
Merlin dc73ac60eb fix: test 2026-02-20 08:52:49 +01:00
Marc Stammerjohann 04d568c7cc chore: format classes functions 2026-01-05 11:38:23 +01:00
Ashley Hunter 3c0ab73226 refactor: replace hlm with new classes utility (#1086)
* feat: adding classes util

* fix: improving hlm

* fix: classes

* fix: classes tests and linting

* feat: adding tests

* fix: perf

* fix: perf improvements

* test: fixing tests
2025-12-22 16:06:40 +01:00
moosme 556a3a5133 Export hlm from brain to helm (#856)
* chore: nightly release 2025-08-24 ⚡

* chore: nightly release 2025-08-25 ⚡

* chore: nightly release 2025-08-26 ⚡

* feat: move hlm from brain to hlm #843

* feat: add utils installation #843

* feat: move tailwind-merge to dependencies #840

* fix: fix tests and add utils test

---------

Co-authored-by: Leonidas <leonidas@spartan.ng>
2025-08-31 18:14:40 +02:00