fix: replace provider indicator with expanded picker

This commit is contained in:
2026-10-18 00:22:36 +02:00
parent d829565188
commit 86632f1d86
3 changed files with 11 additions and 7 deletions
@@ -30,7 +30,7 @@ import Testing
}
}
@Test @MainActor func providerPickerOpensBelowAnchorAndKeepsCurrentSelection() throws {
@Test @MainActor func providerPickerReplacesAnchorDownwardAndKeepsCurrentSelection() throws {
_ = NSApplication.shared
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 750, height: 480),
styleMask: .borderless, backing: .buffered, defer: false)
@@ -47,17 +47,21 @@ import Testing
popup.showProviders(selectedOpenAI: true, relativeTo: anchor)
host.layoutSubtreeIfNeeded()
let rect = popup.view.convert(popup.view.bounds, to: host)
#expect(rect.maxY < pill.frame.minY)
#expect(rect.maxY == pill.frame.maxY)
#expect(rect.minY < pill.frame.minY)
#expect(rect.maxX == pill.frame.maxX)
#expect(pill.alphaValue == 1)
#expect(pill.isAccessibilityHidden())
_ = popup.handle(#selector(NSResponder.insertNewline(_:)))
#expect(selections == [true])
// Reopen during the close animation, then switch modes without retaining the old anchor.
popup.showTranslation(relativeTo: anchor)
popup.showProviders(selectedOpenAI: false, relativeTo: anchor)
host.layoutSubtreeIfNeeded()
#expect(popup.view.convert(popup.view.bounds, to: host).maxY < pill.frame.minY)
#expect(popup.view.convert(popup.view.bounds, to: host).maxY == pill.frame.maxY)
popup.moveSelection(by: 1)
_ = popup.handle(#selector(NSResponder.insertNewline(_:)))
#expect(selections == [true, true])
popup.close(animated: false)
#expect(pill.alphaValue == 1)
#expect(!pill.isAccessibilityHidden())
}