fix(PostIt): disable links without a reader context
Prevent the Markdown viewer's default browser handler from activating when the blog reader has no view model, while keeping reader links bound to PostIt after context changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
dc4412b9e8
commit
b90f15333d
6 changed files with 21 additions and 17 deletions
|
|
@ -130,7 +130,8 @@ public class BlogReaderTests
|
|||
var page = new BlogsPage();
|
||||
var reader = page.FindControl<MarkdownScrollViewer>("ArticleReader")!;
|
||||
var engine = Assert.IsAssignableFrom<IMarkdownEngine2>(reader.Engine);
|
||||
Assert.Null(engine.HyperlinkCommand);
|
||||
Assert.NotNull(engine.HyperlinkCommand);
|
||||
Assert.False(engine.HyperlinkCommand.CanExecute("https://example.test/"));
|
||||
page.DataContext = vm;
|
||||
var nav = new NavigationPage();
|
||||
await nav.PushAsync(page);
|
||||
|
|
@ -152,7 +153,8 @@ public class BlogReaderTests
|
|||
Dispatcher.UIThread.RunJobs();
|
||||
Assert.Empty(vm.ReaderTitle);
|
||||
Assert.Null(vm.ReaderDateModified);
|
||||
Assert.Null(engine.HyperlinkCommand);
|
||||
Assert.NotNull(engine.HyperlinkCommand);
|
||||
Assert.False(engine.HyperlinkCommand.CanExecute("https://example.test/"));
|
||||
Assert.DoesNotContain(sink.Entries, entry => entry.Area == LogArea.Binding);
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
Loading…
Reference in a new issue