From e1ec721740751cbb5324b2137fd0cb19e71efa87 Mon Sep 17 00:00:00 2001 From: James Yeung Date: Wed, 20 Mar 2024 08:15:47 +0800 Subject: [PATCH] fix(module: form): tests failure (#3740) --- components/input/Input.cs | 5 ++++- components/input/TextArea.razor | 11 ++++++++--- components/radio/Radio.razor | 5 ++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/components/input/Input.cs b/components/input/Input.cs index 094e45f497..036c734f9a 100644 --- a/components/input/Input.cs +++ b/components/input/Input.cs @@ -691,7 +691,10 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) } } - builder.AddAttribute(46, "name", NameAttributeValue); + if (!string.IsNullOrWhiteSpace(NameAttributeValue)) + { + builder.AddAttribute(46, "name", NameAttributeValue); + } builder.AddAttribute(50, "id", Id); builder.AddAttribute(51, "type", Type); diff --git a/components/input/TextArea.razor b/components/input/TextArea.razor index a3500743d5..562261b1ed 100644 --- a/components/input/TextArea.razor +++ b/components/input/TextArea.razor @@ -26,7 +26,7 @@ //{ "class", ClassMapper.Class }, { "disabled", Disabled }, { "readonly", ReadOnly }, - }; + }; if (AutoSize == false) { @@ -38,13 +38,18 @@ { Attributes.Keys.ForEach(key => { attributes[key] = Attributes[key]; }); } + + if (!string.IsNullOrEmpty(NameAttributeValue)) + { + attributes.Add("name", NameAttributeValue); + } } @if (Suffix != null || AllowClear || FormItem?.FeedbackIcon != null || ShowCount) {
-