import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import BaseChip from '@/components/BaseChip.vue'

describe('BaseChip', () => {
  it('renders default variant when no prop is passed', () => {
    const wrapper = mount(BaseChip, { slots: { default: 'tag' } })
    expect(wrapper.classes()).toContain('chip')
    expect(wrapper.classes()).toContain('chip--default')
    expect(wrapper.text()).toBe('tag')
  })

  for (const variant of ['default', 'primary', 'success', 'warning', 'error'] as const) {
    it(`renders ${variant} variant class`, () => {
      const wrapper = mount(BaseChip, {
        props: { variant },
        slots: { default: 'x' },
      })
      expect(wrapper.classes()).toContain(`chip--${variant}`)
    })
  }

  it('forwards $attrs onto the root span', () => {
    const wrapper = mount(BaseChip, { attrs: { title: 'tip' } })
    expect(wrapper.attributes('title')).toBe('tip')
  })
})
