diff options
| author | Fuwn <[email protected]> | 2026-02-23 11:55:43 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-23 13:33:43 -0800 |
| commit | 873976418f09f512a66af11161c4ceeefb78fbce (patch) | |
| tree | 38bb0e4a42613061f356fb8ab8747ebe1f1669db /SoraTests | |
| parent | feat: add accessibility metadata to interactive image view (diff) | |
| download | sora-testing-873976418f09f512a66af11161c4ceeefb78fbce.tar.xz sora-testing-873976418f09f512a66af11161c4ceeefb78fbce.zip | |
feat: mark context menu delete actions as destructive
Diffstat (limited to 'SoraTests')
| -rw-r--r-- | SoraTests/ViewDerivedDataTests.swift | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/SoraTests/ViewDerivedDataTests.swift b/SoraTests/ViewDerivedDataTests.swift index 3a1d8df..32e9276 100644 --- a/SoraTests/ViewDerivedDataTests.swift +++ b/SoraTests/ViewDerivedDataTests.swift @@ -361,6 +361,42 @@ final class ViewDerivedDataTests: XCTestCase { // swiftlint:disable:this type_b ) } + func testFavoritesDeleteActionUsesDestructiveRole() throws { + let source = try loadSource(at: "Sora/Views/FavoritesView.swift") + let functionSource = try extractFunction( + named: "private func favoriteGridContent(", + from: source + ) + let destructiveDeleteActionCount = tokenCount( + matching: + #"role:\s*\.destructive[\s\S]*Label\(\s*"Delete"\s*,\s*systemImage:\s*"trash"\s*\)"#, + in: functionSource + ) + + // swiftlint:disable:next prefer_nimble + XCTAssertGreaterThan( + destructiveDeleteActionCount, + 0, + "Favorite context menu delete action should be explicitly destructive." + ) + } + + func testGenericListDeleteActionUsesDestructiveRole() throws { + let source = try loadSource(at: "Sora/Views/Generic/GenericListView.swift") + let destructiveDeleteActionCount = tokenCount( + matching: + #"role:\s*\.destructive[\s\S]*Label\(\s*"Delete"\s*,\s*systemImage:\s*"trash"\s*\)"#, + in: source + ) + + // swiftlint:disable:next prefer_nimble + XCTAssertGreaterThan( + destructiveDeleteActionCount, + 0, + "Generic list context menu delete action should be explicitly destructive." + ) + } + func testListViewsAvoidComparatorRandomShuffleSorting() throws { let listViewSource = try loadSource(at: "Sora/Views/Generic/GenericListView.swift") let favoritesViewSource = try loadSource(at: "Sora/Views/FavoritesView.swift") |