You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enhance mental model documentation with detailed explanations of slottable component children, key differences from React, and testing environments; update Valhalla README for clarity on testing purposes and conventions
1.**Second argument, not a prop:** Children are passed as the second argument to the component function, not as `props.children`.
719
+
720
+
2.**Called "slottable":** The convention is to name it `slottable` rather than `children` to emphasize the difference.
721
+
722
+
3.**You receive DOM, not virtual DOM:** In React, `children` are React elements you can manipulate (clone, map, filter). In Azoth, `slottable` is actual DOM content. Don't try to "muck about" with it — just render it.
723
+
724
+
4.**Composition, not manipulation:** Achieve the same patterns by composing components (nesting) rather than manipulating children programmatically.
- Use for testing compilation behavior, generated code, template structure
777
+
- Add tests here for parser/transpiler-level issues
778
+
779
+
**Happy-dom vs real browsers:** When encountering errors in Node-based test environments (like happy-dom), verify the pattern works in a real browser first. Some DOM behaviors differ between implementations.
780
+
781
+
### See Also
782
+
783
+
-`packages/vahalla/components.test.tsx` — API-level tests for component patterns
784
+
-`packages/vahalla/README.md` — Testing conventions and inline snapshot format
785
+
-`packages/thoth/compiler.test.js` — "component child templates" and "compose component" tests
786
+
-`packages/thoth/transform/Analyzer.js` — How children are analyzed
787
+
-`packages/thoth/transform/Transpiler.js` — How children are transpiled
788
+
789
+
---
790
+
701
791
## Known Issues
702
792
703
793
*Bugs and unexpected behaviors discovered during development:*
**Status:** Fixed — Boolean shorthand now works like JSX/React.
749
839
750
-
**Context:** Discovered while refactoring `FubClientsStage.jsx` where `<FubSimpleRow muted />` caused the error.
840
+
**Context:** Discovered while refactoring `FubClientsStage.jsx` where `<FubSimpleRow muted />` caused the error.
841
+
842
+
### Dynamic Bindings Require DOM Property Names (Not Attribute Names)
843
+
844
+
**Issue:** Dynamic attribute bindings use DOM property assignment, not `setAttribute()`. This means you must use the DOM property name (`className`) rather than the HTML attribute name (`class`).
845
+
846
+
**Root Cause:** In `makeBind()` (template-generators.js), dynamic values are assigned directly to DOM properties:
847
+
```javascript
848
+
t0.className= v0; // Works - className is a DOM property
849
+
t0["class"] = v0; // Fails - "class" is not a valid DOM property
850
+
```
851
+
852
+
**Reproduction:**
853
+
```jsx
854
+
// Static attribute — WORKS (goes into HTML template directly)
855
+
<div class="card">content</div>
856
+
// Output: <div class="card">content</div>
857
+
858
+
// Dynamic with attribute name — BROKEN
859
+
<div class={myClass}>content</div>
860
+
// Output: <div>content</div> ← class missing!
861
+
862
+
// Dynamic with property name — WORKS
863
+
<div className={myClass}>content</div>
864
+
// Output: <div class="highlighted">content</div>
865
+
```
866
+
867
+
**Common attribute → property mappings:**
868
+
-`class` → `className`
869
+
-`for` → `htmlFor`
870
+
-`readonly` → `readOnly`
871
+
-`tabindex` → `tabIndex`
872
+
873
+
**Documented behavior:** See line ~359: "Attributes need attribute names, properties need DOM property names."
874
+
875
+
**Future work:** A translation layer could allow developers to use either name interchangeably (90% complete in separate project).
876
+
877
+
**Workaround:** Use `className` for dynamic class bindings, `class` for static.
Copy file name to clipboardExpand all lines: packages/vahalla/README.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,19 @@
1
1
# Valhalla - Azoth End-to-End Testing
2
2
3
-
Browser-based tests verifying Azoth JSX compilation and rendering.
3
+
Browser-based tests verifying Azoth JSX compilation and rendering at the API level.
4
+
5
+
## Purpose
6
+
7
+
Valhalla tests the **developer-facing JSX interface** — treating JSX as HTML that returns DOM. This is distinct from:
8
+
9
+
-**vite-test/**: A minimal Vite bootstrap project that verifies Azoth works correctly in a standard Vite build environment. Use for build system integration testing.
10
+
-**packages/thoth/compiler.test.js**: Compiler-level tests for the Thoth transpiler. Use for testing compilation output.
0 commit comments