test: add static a11y test.
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Headless;
|
||||||
|
using Avalonia.Headless.XUnit;
|
||||||
|
using Avalonia.Input;
|
||||||
|
|
||||||
|
namespace HeadlessTest.Ursa.Controls.FormTests.AccessibilityTests;
|
||||||
|
|
||||||
|
public class FormAccessibilityTests
|
||||||
|
{
|
||||||
|
[AvaloniaFact]
|
||||||
|
public void Form_Inner_Control_Accessible()
|
||||||
|
{
|
||||||
|
var window = new Window();
|
||||||
|
var form = new StaticForm();
|
||||||
|
window.Content = form;
|
||||||
|
window.Show();
|
||||||
|
|
||||||
|
Assert.False(form.NameBox.IsFocused);
|
||||||
|
Assert.False(form.EmailBox.IsFocused);
|
||||||
|
window.KeyPressQwerty(PhysicalKey.N, RawInputModifiers.Alt);
|
||||||
|
Assert.True(form.NameBox.IsFocused);
|
||||||
|
Assert.False(form.EmailBox.IsFocused);
|
||||||
|
window.KeyPressQwerty(PhysicalKey.E, RawInputModifiers.Alt);
|
||||||
|
Assert.False(form.NameBox.IsFocused);
|
||||||
|
Assert.True(form.EmailBox.IsFocused);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:u="https://irihi.tech/ursa"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
x:Class="HeadlessTest.Ursa.Controls.FormTests.AccessibilityTests.StaticForm">
|
||||||
|
<u:Form>
|
||||||
|
<TextBox Name="NameBox" Width="300" u:FormItem.Label="_Name" />
|
||||||
|
<TextBox Name="EmailBox" Width="300" u:FormItem.Label="_Email" />
|
||||||
|
</u:Form>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace HeadlessTest.Ursa.Controls.FormTests.AccessibilityTests;
|
||||||
|
|
||||||
|
public partial class StaticForm : UserControl
|
||||||
|
{
|
||||||
|
public StaticForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user