diff --git a/CHANGELOG.md b/CHANGELOG.md index 946ee328f..3320ee74f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,11 @@ ### Fixed +* [PostIt.Tests] Les tests du bandeau de session utilisent le bandeau + réellement monté dans la fenêtre headless, au lieu d'un contrôle détaché. + Les fenêtres sont fermées après chaque test et les quatre boutons + de navigation sont vérifiés. + * [PostIt] Les liens Markdown des pièces jointes utilisent désormais le même filtre de nom que l'upload serveur, avant l'encodage URL. Le libellé conserve le nom original, notamment ses accents. diff --git a/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs b/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs index 3516e93d6..f53fffd9a 100644 --- a/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs +++ b/src/PostIt/PostIt.Tests/SessionStatusBannerTests.cs @@ -1,6 +1,5 @@ using Avalonia.Controls; using Avalonia.Headless.XUnit; -using Avalonia.Styling; using Avalonia.VisualTree; using PostIt.ViewModels; using PostIt.Views; @@ -23,41 +22,36 @@ namespace PostIt.Tests; /// new Window().Show() throws because the harness has not /// been initialised for that thread. /// -/// The session banner's DataContext is not wired in -/// these tests: App.OnFrameworkInitializationCompleted is -/// not called in a unit test, so we set the DataContext on the -/// banner directly. The production code path is exercised +/// These tests set the DataContext directly on the banner +/// mounted in the window. The production code path is exercised /// end-to-end by the manual launch, not here. /// -public class SessionStatusBannerTests +public class SessionStatusBannerTests : IDisposable { - [AvaloniaFact] - public void Banner_renders_three_buttons_in_the_visual_tree() - { - MainWindow window = new MainWindow(); - window.Show(); + private MainWindow? _window; - var buttons = window.GetVisualDescendants() + [AvaloniaFact] + public void Banner_renders_four_buttons_in_the_visual_tree() + { + SessionStatusBanner banner = CreateBanner(); + + var buttons = banner.GetVisualDescendants() .OfType