Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sources/QuitConfirmationAlertPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ final class QuitConfirmationAlertPresenter: NSObject, NSWindowDelegate {
}

private func presentStandalone() {
alert.layout()

let buttons = alert.buttons
if buttons.indices.contains(0) {
buttons[0].target = self
Expand Down
7 changes: 7 additions & 0 deletions cmuxTests/QuitConfirmationAlertPresenterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ struct QuitConfirmationAlertPresenterTests {
#expect(!alert.didRunModal)
#expect(completedResponse == nil)

// NSAlert starts with a lazy placeholder layout that stacks full-width
// buttons. The standalone presenter must resolve that layout before the
// alert becomes visible or the panel renders clipped and washed out.
let buttonFrames = alert.buttons.map(\.frame)
#expect(buttonFrames.count == 2)
#expect(abs(buttonFrames[0].midY - buttonFrames[1].midY) < 0.5)

alert.buttons[0].performClick(nil)

#expect(completedResponse == .alertFirstButtonReturn)
Expand Down