Files
bitchat/bitchatTests/ContentComposerAutocorrectTests.swift
Taksh Kothari bfe7bd4b58 feat(ui): enable message autocorrection for normal chat input (#1870)
* feat(ui): enable autocorrection for regular chat messages while preserving it off for commands

* test(ui): add unit tests for composer autocorrection policy

* fix(ui): trim leading whitespace before detecting slash commands for autocorrection

* fix(ui): mark shouldDisableAutocorrection internal for unit test access

* fix(ui): move shouldDisableAutocorrection out of private extension
2026-11-28 14:35:42 -10:00

21 lines
831 B
Swift

//
// ContentComposerAutocorrectTests.swift
// bitchatTests
//
import Testing
@testable import bitchat
struct ContentComposerAutocorrectTests {
@Test func autocorrectionEnabledForNormalMessages() {
#expect(!ContentComposerView.shouldDisableAutocorrection(for: "hello world", isAutocompleting: false))
#expect(!ContentComposerView.shouldDisableAutocorrection(for: "", isAutocompleting: false))
}
@Test func autocorrectionDisabledForSlashCommandsAndAutocomplete() {
#expect(ContentComposerView.shouldDisableAutocorrection(for: "/nick alice", isAutocompleting: false))
#expect(ContentComposerView.shouldDisableAutocorrection(for: " /nick qwerty", isAutocompleting: false))
#expect(ContentComposerView.shouldDisableAutocorrection(for: "hey @al", isAutocompleting: true))
}
}