Skip to content

Commit

Permalink
Fix #471 (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
runceel authored Feb 12, 2024
1 parent 0c0c62a commit ede277e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ private void ErrorMessages_PropertyChanged(object? sender, PropertyChangedEventA
{
if (e.PropertyName != nameof(IReactiveProperty.Value)) return;
PropertyChanged?.Invoke(this, SingletonPropertyChangedEventArgs.ErrorMessage);
ErrorsChanged?.Invoke(this, SingletonDataErrorsChangedEventArgs.Value);
_observeHasErrors.Value = _errorMessages.Value.Length != 0;
ErrorsChanged?.Invoke(this, SingletonDataErrorsChangedEventArgs.Value);
}

private void ObserveHasErrors_PropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,24 @@ public void ForceNotify()
OnNext(0, true));
}

[TestMethod]
public void ErrorChangedTest()
{
var rp = new ValidatableReactiveProperty<string>(
"",
[
x => x == "valid" ? null : "Error!!",
],
mode: ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError);

rp.ErrorsChanged += (_, e) =>
{
Assert.IsTrue(rp.HasErrors);
};

rp.ForceNotify();
}

class Person : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
Expand Down

0 comments on commit ede277e

Please sign in to comment.