mirror of
https://github.com/ziex-dev/ziex.git
synced 2026-07-20 02:29:36 -06:00
test: fix component with missing allocator
This commit is contained in:
parent
1b80e4cd3f
commit
950dfa7aab
@ -35,10 +35,11 @@ pub fn Page(allocator: zx.Allocator) zx.Component {
|
||||
|
||||
const InputProps = struct { value: []const u8, name: []const u8, extra: []const u8 = "" };
|
||||
fn Input(ctx: *zx.ComponentCtx(InputProps)) zx.Component {
|
||||
var _zx = @import("zx").x.init();
|
||||
var _zx = @import("zx").x.allocInit(ctx.allocator);
|
||||
return _zx.ele(
|
||||
.div,
|
||||
.{
|
||||
.allocator = ctx.allocator,
|
||||
.children = &.{
|
||||
_zx.ele(
|
||||
.label,
|
||||
|
||||
@ -20,7 +20,7 @@ pub fn Page(allocator: zx.Allocator) zx.Component {
|
||||
const InputProps = struct { value: []const u8, name: []const u8, extra: []const u8 = "" };
|
||||
fn Input(ctx: *zx.ComponentCtx(InputProps)) zx.Component {
|
||||
return (
|
||||
<div>
|
||||
<div @allocator={ctx.allocator}>
|
||||
<label>{ctx.props.name}</label>
|
||||
<input type="text" {..ctx.props} />
|
||||
<input extra="override-by-spr" {..ctx.props} />
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
pub const components = [_]zx.client.ComponentMeta{
|
||||
|
||||
.{
|
||||
.type = .client,
|
||||
.id = "c8fee6a",
|
||||
|
||||
@ -44,10 +44,11 @@ fn Component(ctx: *zx.ComponentCtx(struct {
|
||||
text: []const u8,
|
||||
name: []const u8,
|
||||
})) zx.Component {
|
||||
var _zx = @import("zx").x.init();
|
||||
var _zx = @import("zx").x.allocInit(ctx.allocator);
|
||||
return _zx.ele(
|
||||
.div,
|
||||
.{
|
||||
.allocator = ctx.allocator,
|
||||
.children = &.{
|
||||
_zx.ele(
|
||||
.p,
|
||||
|
||||
@ -15,7 +15,7 @@ fn Component(ctx: *zx.ComponentCtx(struct {
|
||||
name: []const u8,
|
||||
})) zx.Component {
|
||||
return (
|
||||
<div>
|
||||
<div @allocator={ctx.allocator}>
|
||||
<p>{ctx.props.text}</p>
|
||||
<p>{ctx.props.name}</p>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user