Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/Blazor/ComboChangeEventArgsDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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); }

}

Expand All @@ -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<ComboChangeType>(args["changeType"]); }
if (args.ContainsKey("type"))
Comment thread
skrustev marked this conversation as resolved.
Dismissed
{ this.ChangeType = StringToEnum<ComboChangeType>(args["type"]); }

this.SuppressParentNotify = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/componentsBase/BaseRendererControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ internal T StringToEnum<T>(Object val) where T : struct
}
var str = val.ToString();
T ret;
if (Enum.TryParse<T>(str, out ret))
if (Enum.TryParse<T>(str, true, out ret))
{
return ret;
}
Expand Down
33 changes: 33 additions & 0 deletions tests/IgniteUI.Blazor.Tests/ComboTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IgbCombo<ComboItem>>(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<IgbCombo<ComboItem>>(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<T>(Detail.NewValue) for
Expand Down
Loading