Files
OSGKeyboard/OSGKeyboardTests/AssistantFieldActionTests.swift
T
Rocky 805b01a68e fix(keyboard): synchronize adaptive field actions
Enable the correct host action immediately after keyboard edits and advance the shared build number to 75.
2026-08-16 14:22:48 +08:00

52 lines
1.3 KiB
Swift

import XCTest
@testable import OSGKeyboardShared
@MainActor
final class AssistantFieldActionTests: XCTestCase {
func testContentActionsRequireText() {
let roles: [KeyboardState.ReturnKeyRole] = [
.send,
.go,
.search,
.join,
.route,
.google,
.yahoo
]
for role in roles {
XCTAssertFalse(role.assistantActionAvailable(hasText: false))
XCTAssertTrue(role.assistantActionAvailable(hasText: true))
}
}
func testNavigationActionsRemainAvailableWithoutText() {
let roles: [KeyboardState.ReturnKeyRole] = [
.newline,
.done,
.next,
.continue,
.emergencyCall
]
for role in roles {
XCTAssertTrue(role.assistantActionAvailable(hasText: false))
}
}
func testSearchRolesUseSearchSymbol() {
XCTAssertEqual(
KeyboardState.ReturnKeyRole.search.assistantActionSystemImage,
"magnifyingglass"
)
XCTAssertEqual(
KeyboardState.ReturnKeyRole.google.assistantActionSystemImage,
"magnifyingglass"
)
XCTAssertEqual(
KeyboardState.ReturnKeyRole.yahoo.assistantActionSystemImage,
"magnifyingglass"
)
}
}