import { mount } from '@vue/test-utils' import { describe, expect, it } from 'vitest' import ReleasesPanel from './ReleasesPanel.vue' describe('ReleasesPanel', () => { it('shows validation error without sending an invalid publication', async () => { const wrapper = mount(ReleasesPanel, { props: { products: [] }, global: { stubs: { ElButton: { template: '' }, ElSelect: true, ElOption: true, ElInput: true, ElTable: true, ElTableColumn: true, ElPagination: true }, directives: { loading: () => {} } } }) expect(wrapper.find('[role="alert"]').exists()).toBe(false) await wrapper.findAll('button')[1]!.trigger('click') expect(wrapper.find('[role="alert"]').text()).toContain('请选择产品') expect(wrapper.find('input[type="file"]').attributes('aria-label')).toBe('版本文件') }) })