Skip to content

Add Angular demo, test suites (Vitest + Playwright) and CI#1

Merged
antuuanyf merged 1 commit into
mainfrom
feat/demo-and-tests
May 29, 2026
Merged

Add Angular demo, test suites (Vitest + Playwright) and CI#1
antuuanyf merged 1 commit into
mainfrom
feat/demo-and-tests

Conversation

@antuuanyf

Copy link
Copy Markdown
Owner

Implements the demo Angular and tests steps of docs/next-steps-plan.md (everything except npm publish).

What's included

Demo Angular (demos/angular/)

  • Standalone Angular 19 app (bootstrapApplication) that consumes the built artifacts via file: deps (pretty-modal → core, pretty-modal-angular → its dist), so it validates the real published surface (APF, peer deps, directives + outputs).
  • Mirrors the vanilla demo: origin/center triggers, [prettyModal] dialogs, [prettyModalClose], and (opened)/(closed) outputs.
  • Kept outside the root workspaces on purpose so file: resolves the dist instead of symlinking the source.
  • Required polyfills: ["zone.js"] and preserveSymlinks: true — without the latter the symlinked file: dep pulls a second @angular/core copy (the workspace-hoisted one), causing NG0203.
  • Root scripts: demo:angular, build:demo:angular.

Tests

  • Core — Vitest (happy-dom), 15 tests (packages/core): GSAP mocked; covers open/close, shared data-flip-id, reentrancy guard, reduced-motion, destroy(), SSR without document.
  • e2e — Playwright, 4 tests (e2e/): real animation in Chromium against the vanilla demo — opening/closing classes, mid-flight transform, anchor:'origin' positioning, prefers-reduced-motion.
  • Angular wrapper — Vitest + TestBed, 12 tests (packages/angular): service and directives exercised via runInInjectionContext (no AnalogJS). Covers runOutsideAngular, SSR (PLATFORM_ID='server' doesn't instantiate the core), anchor/dialog resolution, and output emission.

CI (.github/workflows/ci.yml)

Node 22: npm ci → build core + angular → npm test → Playwright chromium → test:e2e → install + build the Angular demo.

Verification

  • npm test: 15 (core) + 12 (angular) passing.
  • npm run test:e2e: 4 passing.
  • Angular demo: builds and boots under ng serve with open/close + outputs working, 0 console errors.

Out of scope

npm publish of both packages — intentionally not done.

Implements the demo + tests steps of docs/next-steps-plan.md:

- demos/angular: standalone Angular 19 app consuming the built artifacts
  via file: deps. Mirrors the vanilla demo through the directives and
  (opened)/(closed) outputs. Needs zone.js polyfill and preserveSymlinks
  (symlinked file: dep would otherwise load a second @angular/core copy).
- packages/core: Vitest (happy-dom) unit tests with GSAP mocked (15 tests).
- e2e: Playwright tests of the real animation against the vanilla demo.
- packages/angular: Vitest + TestBed tests of the service and directives,
  exercised via runInInjectionContext (12 tests).
- CI: GitHub Actions running build + unit + e2e + Angular demo build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antuuanyf antuuanyf merged commit 1432b81 into main May 29, 2026
1 check passed
@antuuanyf antuuanyf deleted the feat/demo-and-tests branch May 30, 2026 16:03
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.

1 participant