feat: add nested-when fixture with Playwright tests#7361
Open
feat: add nested-when fixture with Playwright tests#7361
Conversation
- Added NestedWhenElement class with @observable error, showProgress, enableContinue, clickCount properties and handleClick arrow function - Added <f-template name="nested-when"> with nested <f-when> directives for error/progress/continue-button states - Added pre-rendered shadow DOM with hydration comment markers using - Added 5 Playwright tests covering initial state, error state, showProgress toggle, error toggle, and button interaction - Tests wait for needs-hydration removal before property changes to avoid race conditions during hydration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9174268 to
9b84df5
Compare
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.
Summary
Adds a
nested-whenfixture to thefast-htmltest suite demonstrating nested<f-when>directives with SSR hydration.Changes
packages/fast-html/test/fixtures/when/main.tsNestedWhenElementclass with@observableproperties:error,showProgress,enableContinue,clickCounthandleClickarrow function that incrementsclickCountRenderableFASTElement(NestedWhenElement).defineAsync({ name: 'nested-when', templateOptions: 'defer-and-hydrate' })packages/fast-html/test/fixtures/when/index.html<f-template name="nested-when">with nested<f-when>directives for error/progress/continue-button states<nested-when id="nested-when">with pre-rendered shadow DOM containing hydration comment markersnW0x5kp2Qmpackages/fast-html/test/fixtures/when/when.spec.ts.onlyfrom an existing testshowProgress=falseshows continue button (not disabled)showProgressswitches between progress and buttonerrorswitches between error/retry and normal stateNotes
await expect(element).not.toHaveAttribute('needs-hydration')before modifying properties to ensure hydration is complete before property changes, avoiding a race condition where pre-rendered DOM is visible before FAST bindings are wired up.