// @vitest-environment happy-dom
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import KebabMenu from '../../src/components/common/KebabMenu.vue'
// Canonical kebab primitive (DRY pattern-consistency sweep). Vuetify components
// are left unresolved by the test harness, so we assert the wiring the consumers
// rely on: the trigger's aria-label, the default kebab glyph, and that the
// consumer's menu items (default slot) are rendered inside the menu.
function mountKebab (props = {}) {
return mount(KebabMenu, {
props,
slots: {
default: 'RenameDelete',
},
})
}
describe('KebabMenu', () => {
it('renders the trigger with the provided aria-label and the slotted items', () => {
const w = mountKebab({ label: 'Actions for Foo' })
expect(w.text()).toContain('Rename')
expect(w.text()).toContain('Delete')
expect(w.html()).toContain('Actions for Foo')
})
it('defaults the trigger glyph to the kebab icon', () => {
expect(mountKebab().html()).toContain('mdi-dots-vertical')
})
it('passes presentational props through to the trigger/menu', () => {
const w = mountKebab({ size: 'small', variant: 'flat', location: 'bottom end' })
const html = w.html()
expect(html).toContain('small')
expect(html).toContain('flat')
})
})