import { describe, expect, it } from "vitest"
import { mount } from "@vue/test-utils"
import ImageEditor from "./ImageEditor.vue"

describe("ImageEditor (stub, props-based composition)", () => {
  it("mounts without error", () => {
    const wrapper = mount(ImageEditor)
    expect(wrapper.exists()).toBe(true)
    expect(wrapper.text()).toContain("Image editor")
  })

  it("renders the label via FieldFrame", () => {
    const wrapper = mount(ImageEditor, { props: { label: "Custom label" } })
    expect(wrapper.text()).toContain("Custom label")
  })

  it("hides the label when hideLabel is true", () => {
    const wrapper = mount(ImageEditor, {
      props: { label: "Should hide", hideLabel: true },
    })
    expect(wrapper.find("[data-testid='field-frame-label']").exists()).toBe(
      false,
    )
  })

  it("renders errors from props", () => {
    const wrapper = mount(ImageEditor, {
      props: { label: "X", errors: ["Required"] },
    })
    expect(wrapper.text()).toContain("Required")
  })

  it("renders help text", () => {
    const wrapper = mount(ImageEditor, {
      props: { label: "X", helpText: "Soon!" },
    })
    expect(wrapper.text()).toContain("Soon!")
  })
})
