mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-03 22:27:13 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.1 KiB
Swift
27 lines
1.1 KiB
Swift
#if canImport(UIKit)
|
|
import XCTest
|
|
import UIKit
|
|
@testable import RichTextEditorUIKit
|
|
import RichTextEditorCore
|
|
|
|
final class AttributedStringMapperInlineCodeTests: XCTestCase {
|
|
// Inline-code background must come from the theme, not a hardcoded color.
|
|
func test_inlineCode_backgroundComesFromTheme() {
|
|
let theme = RichTextEditorTheme(
|
|
primaryText: .black, secondaryText: .black, placeholder: .placeholderText,
|
|
accent: .link, tableBorder: .gray, tableHeaderBackground: .gray, codeBackground: .gray,
|
|
inlineCodeBackground: .magenta
|
|
)
|
|
let mapper = AttributedStringMapper(theme: theme)
|
|
let dict = mapper.attributes(for: CharacterAttributes(inlineCode: true), style: .body)
|
|
XCTAssertEqual(dict[.backgroundColor] as? UIColor, .magenta)
|
|
}
|
|
|
|
// Default mapper still reproduces the prior `.systemGray5` pill.
|
|
func test_inlineCode_defaultBackgroundIsSystemGray5() {
|
|
let dict = AttributedStringMapper().attributes(for: CharacterAttributes(inlineCode: true), style: .body)
|
|
XCTAssertEqual(dict[.backgroundColor] as? UIColor, .systemGray5)
|
|
}
|
|
}
|
|
#endif
|