chore: add empty array repeat fixture and parent-to-child attribute passing#7430
Open
chore: add empty array repeat fixture and parent-to-child attribute passing#7430
Conversation
…ssing - Add test-element-empty-array fixture to test repeat directive with empty arrays including add/clear cycle (0 → 3 → 0) - Update nested-elements fixture to pass category attribute from parent to child - Add @attr decorator to item_parent in repeat fixture classes - Add @attr decorator to category in both ItemList and Item classes - Add test verifying runtime parent→child attribute propagation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move category display from child-element template to parent-element template, above the f-repeat. Child elements still receive category as a passed attribute from the parent context. Test now verifies both the parent-rendered text and the attribute on each child element. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add grand-child-element inside child-element's template to render the category attribute. Category now flows parent → child → grand-child, testing three levels of attribute forwarding through nested custom elements. Remove category rendering from parent-element template. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Category is now sourced solely from the @attr decorator and state propagation, not from the mock data source. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
Add more fixture testing for
@microsoft/fast-html:test-element-empty-arrayto the repeat fixture to test thef-repeatdirective with an empty array, including a full add/clear lifecycle (0 → 3 → 0 items).categoryattribute on the parent element is forwarded to each child element via the repeat template binding. A new test verifies both the initial rendered value and runtime propagation when the parent attribute is mutated.@attrdecorators: Add@attrtoitem_parentonTestElementandTestElementWithObserverMapin the repeat fixture, since these properties are set as HTML attributes inentry.html.👩💻 Reviewer Notes
categoryattribute is intentionally not included in the child mock data — the child receives it solely through the parent template binding (category="{{category}}"), ensuring the test validates real attribute forwarding.@attrdecorator was only added to properties that are used as HTML attributes but were missing the decorator. Properties liketitle,text, andidxremain owned byprepare()/deepMerge()to avoid dual source-of-truth conflicts.📑 Test Plan
npm run test -w @microsoft/fast-html— 705 passed).repeat directive with an empty array should render no items— verifies 0 items initially, adding 3 items, then clearing back to 0.should pass parent attribute to child elements— verifies initialcategoryvalue of "General" on child elements, then mutates parentcategoryto "Updated" and verifies propagation.✅ Checklist
General
$ npm run change