Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore(fast-html): use @microsoft/fast-build to build nested-elements fixture",
"packageName": "@microsoft/fast-html",
"email": "7559015+janechu@users.noreply.github.com",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion packages/fast-html/scripts/build-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";

// Builds test fixtures using @microsoft/fast-build. Add fixture names here
// incrementally as each one is verified to work with the fast-build CLI.
const fixtures = ["attribute"];
const fixtures = ["attribute", "nested-elements"];

const __dirname = dirname(fileURLToPath(import.meta.url));
const require = createRequire(import.meta.url);
Expand Down
14 changes: 14 additions & 0 deletions packages/fast-html/test/fixtures/nested-elements/entry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nested Elements Hydration Tests</title>
</head>
<body>
<parent-element title="{{title}}" items="{{items}}"></parent-element>
<parent-element title="Empty List" items="[]"></parent-element>
<parent-element title="Single Item" items='[{"text":"Only Item"}]'></parent-element>
<script type="module" src="./main.ts"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions packages/fast-html/test/fixtures/nested-elements/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "My Items",
"items": [{ "text": "Item 1" }, { "text": "Item 2" }, { "text": "Item 3" }]
}
23 changes: 23 additions & 0 deletions packages/fast-html/test/fixtures/nested-elements/templates.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<f-template name="child-element">
<template>
<div class="item">
<span class="index">{{idx}}</span>
<span class="text">{{text}}</span>
</div>
</template>
</f-template>
<f-template name="parent-element">
<template>
<div class="list-container">
<h2>{{title}}</h2>
<div class="items">
<f-repeat value="{{item in items}}" positioning="true">
<child-element
text="{{item.text}}"
idx="{{$index}}"
></child-element>
</f-repeat>
</div>
</div>
</template>
</f-template>
Loading