angular-component-tests

Render Angular components via test hosts and interact with userEvent in spec files.

9|Updated Jan 18, 2025
One-click install
npx skills add https://github.com/TheNordicOne/ngx-formbar --skill angular-component-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-component-tests
Source: https://github.com/TheNordicOne/ngx-formbar/tree/main/.claude/skills/angular-component-tests
Command: npx skills add https://github.com/TheNordicOne/ngx-formbar --skill angular-component-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Angular component tests often become flaky, hard to maintain, and inconsistent when they bypass real user flows or render strategies.

Core Features & Use Cases

  • Test host pattern: Always render the component under test through a host template instead of creating it directly.
  • Angular Testing Library (ATL) + userEvent: Drive interactions as users would and assert against accessible UI behavior.
  • Overlay escape hatch with CDK harnesses: Handle dialogs/menus/tooltips using CDK harness environments when the overlay is outside the fixture root.

Quick Start

Activate this skill when you are writing or reviewing Angular *.spec.ts files and want to render the component via a host, interact with it using userEvent, and assert using Testing Library queries.

Frequently Asked Questions about angular-component-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write reliable Angular component tests that don't become flaky?

Reliable Angular component tests use a host template for rendering and drive interactions with userEvent to assert against accessible UI behavior. This prevents brittle tests by bypassing direct component creation and simulating real user flows.

How do I test Angular overlays like dialogs and menus that render outside the fixture root?

Test Angular overlays outside the fixture root using CDK harness environments. This provides deterministic overlay verification for dialogs, menus, and tooltips within your Vitest spec files.

Can I use Angular Testing Library with Vitest for component testing?

Yes, Angular Testing Library works with Vitest. This setup allows you to drive user interaction flows and assert using Testing Library queries for deterministic component testing in your spec files.

What is the test host pattern in Angular component testing?

The test host pattern renders the component under test through a host template instead of creating it directly. This ensures your tests evaluate real rendering strategies and prevent inconsistent results.

Why are my Angular component tests brittle when bypassing real user flows?

Angular component tests become brittle when bypassing real user flows because they fail to account for actual render strategies. Using Angular Testing Library and userEvent fixes this by driving interactions as users would.