mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 06:55:59 +01:00
fix: a screen reader says what the date and time hold and that a tree group opens
The date and time pickers were read as a grid: the button inside them now carries the field's label and its value. A scenery group in the tree says whether it is open or closed, and the weather fields are named by their labels.
This commit is contained in:
42
StarterNG.Tests/ExpandableTreeViewItemTests.cs
Normal file
42
StarterNG.Tests/ExpandableTreeViewItemTests.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Automation.Provider;
|
||||
using StarterNG.Controls;
|
||||
|
||||
namespace StarterNG.Tests;
|
||||
|
||||
public class ExpandableTreeViewItemTests
|
||||
{
|
||||
private static IExpandCollapseProvider Peer(ExpandableTreeViewItem item) =>
|
||||
Assert.IsAssignableFrom<IExpandCollapseProvider>(ControlAutomationPeer.CreatePeerForElement(item));
|
||||
|
||||
[Fact]
|
||||
public void A_scenery_with_nothing_under_it_is_a_leaf()
|
||||
{
|
||||
var peer = Peer(new ExpandableTreeViewItem { Header = "test32" });
|
||||
|
||||
Assert.Equal(ExpandCollapseState.LeafNode, peer.ExpandCollapseState);
|
||||
Assert.False(peer.ShowsMenu);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_group_says_whether_it_is_open()
|
||||
{
|
||||
Assert.Equal(ExpandCollapseState.Collapsed, ExpandableTreeViewItem.StateFor(hasChildren: true, expanded: false));
|
||||
Assert.Equal(ExpandCollapseState.Expanded, ExpandableTreeViewItem.StateFor(hasChildren: true, expanded: true));
|
||||
Assert.Equal(ExpandCollapseState.LeafNode, ExpandableTreeViewItem.StateFor(hasChildren: false, expanded: true));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_screen_reader_can_open_and_close_an_entry()
|
||||
{
|
||||
var item = new ExpandableTreeViewItem { Header = "Całkowo" };
|
||||
var peer = Peer(item);
|
||||
|
||||
peer.Expand();
|
||||
Assert.True(item.IsExpanded);
|
||||
|
||||
peer.Collapse();
|
||||
Assert.False(item.IsExpanded);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user