Skip to content

fix(fast-html): add errors fixture for f-template error cases#7406

Draft
janechu wants to merge 2 commits intomainfrom
users/janechu/fix-more-than-one-template-error
Draft

fix(fast-html): add errors fixture for f-template error cases#7406
janechu wants to merge 2 commits intomainfrom
users/janechu/fix-more-than-one-template-error

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented Apr 7, 2026

Pull Request

📖 Description

Adds an errors test fixture for @microsoft/fast-html that covers the two error conditions thrown by the <f-template> element:

  • No template element present — when an <f-template> contains no <template> child, a noTemplateProvided error (code 2000) is thrown.
  • Multiple template elements present — when an <f-template> contains more than one <template> child, a moreThanOneTemplateProvided error (code 2001) is thrown.

The fixture includes index.html, main.ts, and errors.spec.ts. Tests use page.addInitScript to intercept unhandledrejection events (the errors originate inside an unhandled promise chain) for reliable cross-browser coverage across Chromium, Firefox, and WebKit.

📑 Test Plan

Run the new fixture tests:

cd packages/fast-html
npx playwright test test/fixtures/errors/errors.spec.ts

All 6 tests pass (2 cases × 3 browsers).

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

janechu and others added 2 commits April 7, 2026 14:14
Add a test fixture that covers the two error conditions thrown by the
f-template element: no template element present and multiple template
elements present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu changed the title test: add errors fixture for f-template error cases fix(fast-html): add errors fixture for f-template error cases Apr 7, 2026
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