Two widths, one height — the symbol picker squares to 5:4, colour holds 6:4, and None's slash follows the swatch out of the grid
The owner's follow-up review on the shipped rectangles (Pipeline card 5004c540): height was close, so it stays exactly 2.1em on both controls; width now diverges by role via PickerRectMetrics.WidthRatio (color 1.5, symbol 1.25) instead of one shared multiplier. The symbol glyph gets a small em-derived inset back (SymbolGlyphControl.glyphInset) — a sliver of breath, not the old padded ring — applied to the face rect before sizing and fitting, still centred on the same midpoint. The collapsed colour swatch reuses ColorSwatchNoneStrike's own geometry to draw the popover's None slash whenever the stored value is nil or unresolvable, rather than sitting empty. Both mounting anchors (the card sidebar's side-by-side columns, the board popover beside the rename field) pick up .fixedSize() so the controls render at their own intrinsic size instead of stretching into whatever slack an HStack proposal leaves them. KanbanTests/SymbolCatalogTests.swift and ColorSwatchPickerTests.swift updated for the per-role widths, the shared-height claim, the glyph inset rule, and the None-face predicate.
This commit is contained in:
@@ -88,3 +88,35 @@ struct ColorSwatchPopoverLayoutTests {
|
||||
#expect(layout.popoverWidth == layout.gridWidth + layout.contentPadding * 2)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - The collapsed face's None treatment
|
||||
|
||||
/// **The owner's 2026-08-10 follow-up, verbatim**: "when 'none' selected the strike-through line
|
||||
/// should show on the selected color too." `ColorSwatchControl.showsNoneStrike(for:)` is the pure
|
||||
/// predicate behind that draw — the same lenient "nil or unresolvable both read as no colour" rule
|
||||
/// `StyleWellFace.Face.color`'s own doc already states for the popover's grid, restated here for the
|
||||
/// collapsed face so the two surfaces cannot drift apart about what counts as "None."
|
||||
@Suite("ColorSwatchControl ▸ the None face")
|
||||
struct ColorSwatchControlNoneFaceTests {
|
||||
|
||||
@Test("A nil value shows the None strike")
|
||||
func nilShowsTheStrike() {
|
||||
#expect(ColorSwatchControl.showsNoneStrike(for: nil))
|
||||
}
|
||||
|
||||
@Test("A resolvable palette name does not show the strike")
|
||||
func resolvableNameHidesTheStrike() {
|
||||
let name = Palette.backgrounds[0].name
|
||||
#expect(!ColorSwatchControl.showsNoneStrike(for: name))
|
||||
}
|
||||
|
||||
@Test("A resolvable hand-written hex does not show the strike")
|
||||
func resolvableHexHidesTheStrike() {
|
||||
#expect(!ColorSwatchControl.showsNoneStrike(for: "#336699"))
|
||||
}
|
||||
|
||||
@Test("An unresolvable stored value shows the strike, the same lenient rule the popover's grid uses")
|
||||
func unresolvableValueShowsTheStrike() {
|
||||
#expect(ColorSwatchControl.showsNoneStrike(for: "not-a-real-palette-name"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user