test(13-04): add failing tests for IconButton, UIIcon, Space, and Button icon wiring (RED)
This commit is contained in:
parent
fbdf188f5f
commit
fa2405938a
1 changed files with 67 additions and 0 deletions
|
|
@ -397,3 +397,70 @@ func TestTable_RendersShell(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 13 Plan 04 — IconButton, UIIcon, Space, and Button icon wiring tests (TDD RED)
|
||||
|
||||
func TestIconButton_GhostNeutral(t *testing.T) {
|
||||
out := render(t, context.Background(), IconButton(IconButtonProps{
|
||||
Icon: "plus",
|
||||
Variant: IconButtonVariantNeutral,
|
||||
Tone: IconButtonToneGhost,
|
||||
Label: "Add",
|
||||
}))
|
||||
if !strings.Contains(out, "borderless-icon-button") {
|
||||
t.Errorf("expected borderless-icon-button class; got: %s", out)
|
||||
}
|
||||
if !strings.Contains(out, `aria-label="Add"`) {
|
||||
t.Errorf("expected aria-label=\"Add\"; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIconButton_SolidDanger(t *testing.T) {
|
||||
out := render(t, context.Background(), IconButton(IconButtonProps{
|
||||
Icon: "trash",
|
||||
Variant: IconButtonVariantDanger,
|
||||
Tone: IconButtonToneSolid,
|
||||
Label: "Delete",
|
||||
}))
|
||||
if !strings.Contains(out, "ui-icon-button-solid") {
|
||||
t.Errorf("expected ui-icon-button-solid class; got: %s", out)
|
||||
}
|
||||
if !strings.Contains(out, "ui-icon-button-danger") {
|
||||
t.Errorf("expected ui-icon-button-danger class; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIIcon_Plus(t *testing.T) {
|
||||
out := render(t, context.Background(), UIIcon("plus"))
|
||||
if !strings.Contains(out, "<svg") {
|
||||
t.Errorf("expected <svg in output for 'plus' icon; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIIcon_Fallback(t *testing.T) {
|
||||
out := render(t, context.Background(), UIIcon("unknown-kind"))
|
||||
if !strings.Contains(out, "<span") {
|
||||
t.Errorf("expected <span fallback for unknown icon kind; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpaceX_MD(t *testing.T) {
|
||||
out := render(t, context.Background(), SpaceX(SpaceProps{Size: SpacingStepMD}))
|
||||
if !strings.Contains(out, "ui-space-x-md") {
|
||||
t.Errorf("expected ui-space-x-md in output; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpaceY_LG(t *testing.T) {
|
||||
out := render(t, context.Background(), SpaceY(SpaceProps{Size: SpacingStepLG}))
|
||||
if !strings.Contains(out, "ui-space-y-lg") {
|
||||
t.Errorf("expected ui-space-y-lg in output; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestButton_IconRendered(t *testing.T) {
|
||||
out := render(t, context.Background(), Button(ButtonProps{Label: "Add", Icon: "plus"}))
|
||||
if !strings.Contains(out, "<svg") {
|
||||
t.Errorf("expected <svg in output when Button.Icon is set; got: %s", out)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue