Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ede277e

Browse filesBrowse files
authored
Fix #471 (#472)
1 parent 0c0c62a commit ede277e
Copy full SHA for ede277e

File tree

Expand file treeCollapse file tree

2 files changed

+19
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-1
lines changed

‎Source/ReactiveProperty.Core/ValidatableReactiveProperty.cs

Copy file name to clipboardExpand all lines: Source/ReactiveProperty.Core/ValidatableReactiveProperty.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ private void ErrorMessages_PropertyChanged(object? sender, PropertyChangedEventA
367367
{
368368
if (e.PropertyName != nameof(IReactiveProperty.Value)) return;
369369
PropertyChanged?.Invoke(this, SingletonPropertyChangedEventArgs.ErrorMessage);
370-
ErrorsChanged?.Invoke(this, SingletonDataErrorsChangedEventArgs.Value);
371370
_observeHasErrors.Value = _errorMessages.Value.Length != 0;
371+
ErrorsChanged?.Invoke(this, SingletonDataErrorsChangedEventArgs.Value);
372372
}
373373

374374
private void ObserveHasErrors_PropertyChanged(object? sender, PropertyChangedEventArgs e)

‎Test/ReactiveProperty.NETStandard.Tests/ValidatableReactivePropertyTest.cs

Copy file name to clipboardExpand all lines: Test/ReactiveProperty.NETStandard.Tests/ValidatableReactivePropertyTest.cs
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,24 @@ public void ForceNotify()
403403
OnNext(0, true));
404404
}
405405

406+
[TestMethod]
407+
public void ErrorChangedTest()
408+
{
409+
var rp = new ValidatableReactiveProperty<string>(
410+
"",
411+
[
412+
x => x == "valid" ? null : "Error!!",
413+
],
414+
mode: ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError);
415+
416+
rp.ErrorsChanged += (_, e) =>
417+
{
418+
Assert.IsTrue(rp.HasErrors);
419+
};
420+
421+
rp.ForceNotify();
422+
}
423+
406424
class Person : INotifyPropertyChanged
407425
{
408426
public event PropertyChangedEventHandler PropertyChanged;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.