testing-unit

Standardize TypeScript Jasmine unit tests for web components.

335|45|Updated Aug 13, 2015
One-click install
npx skills add https://github.com/blueprintui/blueprintui --skill testing-unit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-unit
Source: https://github.com/blueprintui/blueprintui/tree/main/.claude/skills/testing-unit
Command: npx skills add https://github.com/blueprintui/blueprintui --skill testing-unit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides developers in writing thorough unit tests for web components, ensuring individual functionalities work as expected and preventing logical errors. It streamlines the process of verifying component behavior, saving time on debugging and manual quality assurance.

Core Features & Use Cases

  • Comprehensive Test Patterns: Provides templates and best practices for testing basic component creation, properties, CSS states, accessibility, and form association.
  • Event & Interaction Testing: Details how to effectively test event handling, user interactions, and the rendering of CSS parts.
  • Quality Assurance Checklist: Offers a detailed checklist to ensure all critical aspects of a component are covered by unit tests.
  • Use Case: When developing a new interactive web component, activate this skill to guide you through writing unit tests that cover all its properties, events, and accessibility features. This ensures its core logic is sound and reliable from the start.

Quick Start

Using the testing-unit skill, generate a basic unit test template for a new 'bp-toggle' component, including checks for default properties and event handling.

Frequently Asked Questions about testing-unit

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

FAQPage Schema
How do I write unit tests for web components in Jasmine?

Unit tests for web components in Jasmine follow standardized patterns: create fixtures with createFixture, verify element stability with elementIsStable, and assert default properties and reflected attributes. This Skill provides templates covering component creation, properties, CSS states, accessibility, and event handling to ensure thorough coverage of component logic.

What should I test in a web component unit test?

Comprehensive web component unit tests cover basic component creation, inherited properties, CSS state changes, ARIA attributes, event handling, form association, CSS parts, and CSS custom properties. This Skill provides a quality assurance checklist to ensure all critical aspects of component behavior are validated and logical errors are prevented.

How do I test event handling and user interactions in web components?

Event handling tests verify that components respond correctly to user interactions and emit expected events. This Skill details patterns for testing event firing, interaction results, and rendering of CSS parts, ensuring component interactions work reliably alongside property and accessibility validation.

Can I use this testing approach with TypeScript web components?

Yes. This Skill standardizes unit testing practices specifically for TypeScript web components with Jasmine, colocated alongside component files. It covers static property validation, fixture teardown, and assertion patterns tailored to TypeScript component architecture and type safety.

How do I test accessibility attributes in web components?

Accessibility testing in web components validates ARIA attributes and internal state that affect assistive technology. This Skill specifies assertion patterns for checking accessibility features as part of comprehensive unit test coverage, ensuring components meet accessibility standards from development.

What's the best way to structure fixture setup and teardown in component tests?

This Skill specifies fixture setup using createFixture and teardown with removeFixture, with element stability checks via elementIsStable to ensure reliable test execution. These patterns standardize test lifecycle management across component test suites.