-
-
Notifications
You must be signed in to change notification settings - Fork 596
Expand file tree
/
Copy pathAutomationNameTests.cs
More file actions
47 lines (40 loc) · 1.54 KB
/
Copy pathAutomationNameTests.cs
File metadata and controls
47 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Avalonia.Automation;
using Avalonia.Controls;
using Avalonia.VisualTree;
using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Languages;
using StabilityMatrix.Core.Models.Documentation;
namespace StabilityMatrix.UITests;
[Collection("TempDir")]
public class AutomationNameTests : TestBase
{
/// <summary>
/// The pane toggle is named via a /template/ style selector in MainWindow.axaml, which
/// silently matches nothing if FluentAvalonia renames the template part.
/// </summary>
[AvaloniaFact]
public async Task NavigationTogglePaneButton_ShouldHaveAutomationName()
{
var (window, _) = GetMainWindow();
await DoInitialSetup();
var toggleButton = window
.FindDescendantOfType<NavigationView>()!
.GetVisualDescendants()
.OfType<Button>()
.FirstOrDefault(b => b.Name == "TogglePaneButton");
Assert.NotNull(toggleButton);
Assert.Equal("Toggle Navigation", AutomationProperties.GetName(toggleButton));
}
/// <summary>
/// Icon-only control: the accessible name comes from the control theme, not content.
/// </summary>
[AvaloniaFact]
public void DocsHelpButton_ShouldHaveAutomationName()
{
var button = new DocsHelpButton { DocsPath = DocumentationPages.EnvironmentVariables };
var window = new Window { Content = button };
window.Show();
Assert.Equal(Resources.Label_ViewDocumentation, AutomationProperties.GetName(button));
}
}