diff --git a/src/HexManiac.Core/ViewModels/ChangeHistory.cs b/src/HexManiac.Core/ViewModels/ChangeHistory.cs index 1b3dc860..fd42afa9 100644 --- a/src/HexManiac.Core/ViewModels/ChangeHistory.cs +++ b/src/HexManiac.Core/ViewModels/ChangeHistory.cs @@ -160,9 +160,10 @@ namespace HavenSoft.HexManiac.Core.ViewModels { var hasDataChange = HasDataChange; if (hasDataChange != hasDataChangeCache) { hasDataChangeCache = hasDataChange; - NotifyPropertyChanged(nameof(HasDataChange), nameof(IsSaved)); + NotifyPropertiesChanged(nameof(HasDataChange), nameof(IsSaved)); + } else if (!hasDataChange && currentChange.HasAnyChange) { + NotifyPropertyChanged(nameof(IsSaved)); } - if (!hasDataChange && currentChange.HasAnyChange) NotifyPropertyChanged(nameof(IsSaved)); } private void UndoExecuted() { diff --git a/src/HexManiac.Tests/Before_Baseclass/ChangeHistoryTests.cs b/src/HexManiac.Tests/Before_Baseclass/ChangeHistoryTests.cs index f475430b..8064ded9 100644 --- a/src/HexManiac.Tests/Before_Baseclass/ChangeHistoryTests.cs +++ b/src/HexManiac.Tests/Before_Baseclass/ChangeHistoryTests.cs @@ -496,5 +496,28 @@ namespace HavenSoft.HexManiac.Tests { Assert.Equal(3, recentChanges.Count); } + + [Fact] + public void DataChange_Name_ContainsAstrisk() { + var view = new StubView(ViewPort); + + ViewPort.Edit("03"); + + Assert.EndsWith("*", ViewPort.Name); + Assert.True(ViewPort.ChangeHistory.HasDataChange); + Assert.Contains(nameof(ViewPort.Name), view.PropertyNotifications); + Assert.Contains(nameof(ViewPort.Save), view.CommandCanExecuteChangedNotifications); + } + + [Fact] + public void NonDataChange_Name_NoAstrisk() { + var view = new StubView(ViewPort); + + ViewPort.Edit("^test "); + + Assert.False(ViewPort.Name.EndsWith("*")); + Assert.False(ViewPort.ChangeHistory.HasDataChange); + Assert.Contains(nameof(ViewPort.Save), view.CommandCanExecuteChangedNotifications); + } } }