diff --git a/src/components/Blazor/ComboChangeEventArgsDetail.cs b/src/components/Blazor/ComboChangeEventArgsDetail.cs index 0bf9b754..36e7940e 100644 --- a/src/components/Blazor/ComboChangeEventArgsDetail.cs +++ b/src/components/Blazor/ComboChangeEventArgsDetail.cs @@ -147,7 +147,7 @@ protected internal override void ToEventJson(BaseRendererControl control, Dictio if (IsPropDirty("Items")) { args["items"] = ObjectArrayToParam(this._items); } if (IsPropDirty("ChangeType")) - { args["changeType"] = EnumToString(this._changeType); } + { args["type"] = EnumToString(this._changeType); } } @@ -161,8 +161,8 @@ protected internal override void FromEventJson(BaseRendererControl control, Dict { this.NewValue = ReturnToObjectArray(args["newValue"]); } if (args.ContainsKey("items")) { this.Items = ReturnToObjectArray(args["items"]); } - if (args.ContainsKey("changeType")) - { this.ChangeType = StringToEnum(args["changeType"]); } + if (args.ContainsKey("type")) + { this.ChangeType = StringToEnum(args["type"]); } this.SuppressParentNotify = false; } diff --git a/src/componentsBase/BaseRendererControl.cs b/src/componentsBase/BaseRendererControl.cs index b0ea3d1f..b6273278 100644 --- a/src/componentsBase/BaseRendererControl.cs +++ b/src/componentsBase/BaseRendererControl.cs @@ -2700,7 +2700,7 @@ internal T StringToEnum(Object val) where T : struct } var str = val.ToString(); T ret; - if (Enum.TryParse(str, out ret)) + if (Enum.TryParse(str, true, out ret)) { return ret; } diff --git a/tests/IgniteUI.Blazor.Tests/ComboTests.cs b/tests/IgniteUI.Blazor.Tests/ComboTests.cs index 30528983..6a8763a0 100644 --- a/tests/IgniteUI.Blazor.Tests/ComboTests.cs +++ b/tests/IgniteUI.Blazor.Tests/ComboTests.cs @@ -282,6 +282,39 @@ public void Combo_CaseSensitiveIcon_Property() combo.CaseSensitiveIcon = true; Assert.True(combo.CaseSensitiveIcon); } + + [Fact] + public void Combo_Change_SelectionEvent_HasSelectionChangeType() + { + Interop.PrimeReady(); + IgbComboChangeEventArgs? received = null; + var cut = Render>(ps => ps + .Add(c => c.Data, new[] { _valueItem1, _valueItem2 }) + .Add(c => c.Change, (IgbComboChangeEventArgs args) => received = args)); + + var argsJson = ChangeDetail(UuidRef(Interop, cut, 0), UuidRef(Interop, cut, 0)); + Interop.RaiseEvent(Interop.ContainerIdOf(cut), "Change", argsJson); + + Assert.NotNull(received); + Assert.Equal(ComboChangeType.Selection, received.Detail.ChangeType); + } + + [Fact] + public void Combo_Change_DeselectionEvent_HasDeselectionChangeType() + { + Interop.PrimeReady(); + IgbComboChangeEventArgs? received = null; + var cut = Render>(ps => ps + .Add(c => c.Data, new[] { _valueItem1, _valueItem2 }) + .Add(c => c.Value, new[] { _valueItem1 }) + .Add(c => c.Change, (IgbComboChangeEventArgs args) => received = args)); + + var argsJson = ChangeDetail("", UuidRef(Interop, cut, 0), "deselection"); + Interop.RaiseEvent(Interop.ContainerIdOf(cut), "Change", argsJson); + + Assert.NotNull(received); + Assert.Equal(ComboChangeType.Deselection, received.Detail.ChangeType); + } } // TODO: Mismatched T=int inbound handling (T[])DowncastArray(Detail.NewValue) for