Skip to content

chore(fast-html): use @microsoft/fast-build to build host-bindings fixture#7384

Merged
janechu merged 6 commits intomainfrom
users/janechu/update-fixture-to-use-fast-build-host-bindings
Apr 8, 2026
Merged

chore(fast-html): use @microsoft/fast-build to build host-bindings fixture#7384
janechu merged 6 commits intomainfrom
users/janechu/update-fixture-to-use-fast-build-host-bindings

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented Apr 4, 2026

Pull Request

📖 Description

Adds the host-bindings test fixture to @microsoft/fast-html and generates its index.html using @microsoft/fast-build, consistent with the other fixtures (attribute, binding, event, ref, slotted, when, repeat, repeat-event, children).

The host-bindings fixture covers host-level attribute directives on the <template> element — event bindings (@click), boolean attr bindings (?disabled), property bindings (:title), and regular attr bindings (attr). It exercises multiple element permutations to verify that content binding indexes inside the shadow DOM are correctly offset when host bindings are present.

Entry elements in entry.html carry no {{binding}} attributes — root JSON state is passed implicitly by @microsoft/fast-build. Static literal values that differ per element (e.g. text="content text") are kept as-is since they represent unique per-element data not covered by root state.

🎫 Issues

No open issues directly addressed.

📑 Test Plan

  • npm run build:fixtures in packages/fast-html runs cleanly and regenerates host-bindings/index.html — resolved binding attrs are stripped from entry element opening tags, shadow DOM hydration markers are correct, and content is rendered from root state.
  • All other fixture outputs are unchanged.
  • Playwright spec (host-bindings.spec.ts) covers 11 tests verifying correct index offsets after hydration across all host binding type permutations.

✅ 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.

⏭ Next Steps

  • Verify CI passes for all 11 Playwright tests in the host-bindings spec.

janechu and others added 2 commits April 7, 2026 20:40
…xture

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ing attrs

Rebase onto main (includes all previous fixtures up to children).
Resolved build-fixtures.js conflict by appending 'host-bindings' to the
full fixture list.

Remove {{binding}} attrs from entry elements — root JSON state is passed
implicitly by @microsoft/fast-build. Static literal attrs (text, id,
first/second for host-multi-content-element) are preserved since they
represent per-element values not covered by root state.

Fixture regenerated: resolved binding attrs (greeting, text, disabled,
first, second, attr/disabled) stripped from entry element opening tags
while shadow DOM content remains correct.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu force-pushed the users/janechu/update-fixture-to-use-fast-build-host-bindings branch from 2371e55 to fc09fba Compare April 8, 2026 03:41
@janechu janechu marked this pull request as ready for review April 8, 2026 03:41
janechu and others added 4 commits April 7, 2026 20:44
Add back the style block from the original index.html into entry.html
so it is preserved through the fast-build fixture generation. Regenerated
index.html now includes the display:block styles for all custom elements.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ture

Change isDisabled from @observable to @attr({ mode: 'boolean', attribute: 'disabled' })
in HostMultiElement, HostAllTypesElement, and HostPermutationBase.

@observable does not auto-reflect to HTML attributes. In defer-and-hydrate mode,
FAST does not re-apply ?boolean host template bindings to the custom element, so
the disabled attribute was never set after removing the ?disabled={{isDisabled}}
entry-level binding.

With @attr({ mode: 'boolean' }), FAST auto-reflects the default isDisabled=true
to disabled="" when the element connects, satisfying the test assertions without
needing SSR pre-rendering via entry.html binding attrs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Revert isDisabled back to @observable (undoing the @attr change).
Instead, add static attributes disabled and attr="value" directly to
the entry elements that need them — these are pre-rendered by fast-build
into index.html, matching the original fixture output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu merged commit c68c2be into main Apr 8, 2026
14 checks passed
@janechu janechu deleted the users/janechu/update-fixture-to-use-fast-build-host-bindings branch April 8, 2026 15:45
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