Realign the Cmd-N target rule — a multi-selection anchors at its last member
The corpus just ratified the plural case: a multi-selection anchors at its last member in flatten order (lane order, then card order — the multi-drag order, the same anchor paste will use), so creation follows the last selected card or appends to the last selected lane instead of falling through to the last-active lane. One display-order walk keeps the resolver pure; the sole selection is now just the degenerate one-member case. Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
@@ -158,16 +158,32 @@ struct NewCardTargetTests {
|
||||
#expect(resolve(snapshot) == nil)
|
||||
}
|
||||
|
||||
@Test("A multi-selection and a stale one both fall through rather than guessing")
|
||||
func pluralAndStaleSelectionsFallThrough() throws {
|
||||
@Test("A multi-selection anchors at its last member in flatten order")
|
||||
func pluralSelectionsAnchorAtTheirLastMember() throws {
|
||||
let fixture = try makeBoard()
|
||||
defer { fixture.tearDown() }
|
||||
let snapshot = try BoardLoader.load(boardRoot: fixture.root).model
|
||||
|
||||
// The rule speaks of "a card"/"a lane", singular; a multi-selection has no "it" to be
|
||||
// immediately after, so it gets the same answer as no selection at all.
|
||||
// "A multi-selection anchors at its last member in flatten order (lane `order`, then card
|
||||
// `order`, the multi-drag order)": card3 lives in lane2, which sorts after lane1's pair, so
|
||||
// creation follows card3 — the last-active lane never enters into it.
|
||||
#expect(resolve(snapshot, selection: ItemReferenceSet(ids: [card1, card3], liveness: .live), lastActive: lane1)
|
||||
== NewCardTarget.Resolution(laneID: lane2, anchorCardID: card3))
|
||||
|
||||
// Within one lane the flatten order is card order: card2 sorts after card1.
|
||||
#expect(resolve(snapshot, selection: ItemReferenceSet(ids: [card1, card2], liveness: .live), lastActive: lane2)
|
||||
== NewCardTarget.Resolution(laneID: lane1, anchorCardID: card2))
|
||||
|
||||
// A multi-LANE selection appends to the last selected lane's bottom.
|
||||
#expect(resolve(snapshot, selection: ItemReferenceSet(ids: [lane1, lane2], liveness: .live))
|
||||
== NewCardTarget.Resolution(laneID: lane2, anchorCardID: nil))
|
||||
}
|
||||
|
||||
@Test("A stale selection falls through rather than guessing or refusing")
|
||||
func staleSelectionsFallThrough() throws {
|
||||
let fixture = try makeBoard()
|
||||
defer { fixture.tearDown() }
|
||||
let snapshot = try BoardLoader.load(boardRoot: fixture.root).model
|
||||
|
||||
// A selection naming something the board does not render — the reload that drops it has not
|
||||
// landed yet — must not refuse the creation the user just asked for.
|
||||
|
||||
Reference in New Issue
Block a user