import Foundation import Testing @testable import EquipoKit #if os(macOS) import AppKit @testable import EquipoMac #endif struct ComposerPolishTests { // This suite follows the existing source-contract tests; there is no // ViewInspector dependency. The simulator also exercises a real drag. @Test(arguments: ["ConversationScreen.swift", "TaskDetailScreen.swift", "NeedsScreen.swift"]) func scrollsContainingReplyFieldsDismissInteractively(_ file: String) throws { let sources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("Sources/EquipoKit/UI/Screens") let source = try String(contentsOf: sources.appendingPathComponent(file), encoding: .utf8) #expect(source.contains(".scrollDismissesKeyboard(.interactively)")) } #if os(macOS) @MainActor @Test func attachmentButtonIsOutsideFieldWithFullTarget() throws { let composer = MacComposer() composer.attach(AttachmentDraft(client: EquipoClient(transport: AttachmentServer(), token: "fixture"))) composer.frame = NSRect(x: 0, y: 0, width: 600, height: 80) composer.layoutSubtreeIfNeeded() let button = try #require(composer.subviews.compactMap { $0 as? NSButton }.first { $0.accessibilityLabel() == EquipoStrings.text("chat.attach.add") }) #expect(button.frame.width >= 44) #expect(button.frame.height >= 44) #expect(button.frame.maxX < composer.pill.frame.minX) #expect(composer.send.frame.width >= 44) #expect(composer.send.frame.height >= 44) } @MainActor @Test func macPanelAcceptsMultipleFilesOnly() { let panel = MacComposer.makeAttachmentPanel() #expect(panel.canChooseFiles) #expect(!panel.canChooseDirectories) #expect(panel.allowsMultipleSelection) } #endif }