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
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,13 @@ public nonisolated enum ActionMenuContext: String, CaseIterable, Sendable, Hasha
case .priorityRow: .agentChat
}
}

/// The kinds of the objects this menu's target holds whose actions its rows offer, with the
/// target as their place. The tab bar's empty area targets its pane and offers New Tab and
/// Reopen Closed Tab, which act on the pane's tabs (Chrome's and Edge's tab strip menus); the
/// handlers take the pane as the place. Surface coverage counts such a row for its action's
/// target kind (`ActionSurfaceParityTests`). Every other menu's rows act on its target itself.
public var contentKinds: [ActionTargetKind] {
self == .tabStrip ? [.tab] : []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ import Testing
/// target supplies), unless the action says why not. A placement in an
/// object-less menu (the sidebar or screen bar background) also counts:
/// creating actions take their place from the focused object there; so
/// does a menu on a contained object (a tab's menu reaches its pane).
/// does a menu on a contained object (a tab's menu reaches its pane), and
/// a menu whose rows act on what its object holds (the tab bar's empty
/// area, on its pane, offers New Tab: `ActionMenuContext.contentKinds`).
@Test func everyTargetKindMenuShowsItsActions() {
let kindsWithMenus = Set(ActionMenuContext.allCases.compactMap(\.targetKind))
var gaps: [String] = []
Expand All @@ -71,6 +73,7 @@ import Testing
let placed = plan.contextMenus.contains { placement in
guard let menuKind = placement.context.targetKind else { return true }
return kinds.contains(menuKind) || !kinds.isDisjoint(with: menuKind.containers)
|| !kinds.isDisjoint(with: placement.context.contentKinds)
}
if !placed && plan.contextMenuExemption == nil {
gaps.append("\(descriptor.id.rawValue) (\(kind.rawValue))")
Expand Down
Loading