mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-29 08:29:22 +00:00
* 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
21 lines
831 B
Swift
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))
|
|
}
|
|
}
|