From 9e3782c79747e5f01a14965be1d99946206fb7db Mon Sep 17 00:00:00 2001 From: Christian Mortaro Date: Mon, 30 Jan 2023 20:28:40 -0300 Subject: [PATCH 01/12] :sparkles: allow bind textarea to undefined --- plugins/bindable.js | 2 +- tests/src/TwoWayBindings.njs | 2 ++ tests/src/TwoWayBindings.test.js | 18 ++++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/bindable.js b/plugins/bindable.js index efcf938e..b3424084 100644 --- a/plugins/bindable.js +++ b/plugins/bindable.js @@ -9,7 +9,7 @@ function transform({ node, environment }) { const object = node.attributes.bind.object ?? {} const property = node.attributes.bind.property if (node.type === 'textarea') { - node.children = [object[property]] + node.children = [object[property] ?? ''] } else if (node.type === 'input' && node.attributes.type === 'checkbox') { node.attributes.checked = object[property] } else { diff --git a/tests/src/TwoWayBindings.njs b/tests/src/TwoWayBindings.njs index cc73b6b7..64a77596 100644 --- a/tests/src/TwoWayBindings.njs +++ b/tests/src/TwoWayBindings.njs @@ -97,6 +97,8 @@ class TwoWayBindings extends Nullstack { +