import { mount } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';
import ProductFilterBar from '../app/components/product/ProductFilterBar.vue';

describe('ProductFilterBar', () => {
  it('keeps search visible while showing a separate clear button for text', async () => {
    const wrapper = mount(ProductFilterBar, {
      props: { keyword: '' },
    });

    await wrapper.get('input').setValue('卫衣');

    expect(wrapper.get('button[type="submit"]').text()).toBe('搜索');
    expect(wrapper.get('.clear-search').attributes('aria-label')).toBe('清除搜索');
  });
});
