import '../../../dist/zn.min.js'; import { expect, fixture, html } from '@open-wc/testing'; import type ZnFilterContainer from './filter-container.component'; const nextFrame = () => new Promise(requestAnimationFrame); describe('', () => { it('should render a component', async () => { const el = await fixture(html` `); expect(el).to.exist; }); it('hides non-matching items and empty panels', async () => { const el = await fixture(html`
`); el.handleSearchChange({target: {value: 'app'}} as unknown as Event); await nextFrame(); expect(el.querySelector('[data-filter="Apple"]')!.style.display).to.equal(''); expect(el.querySelector('[data-filter="Banana"]')!.style.display).to.equal('none'); expect(el.querySelector('#fruit')!.style.display).to.equal(''); expect(el.querySelector('#veg')!.style.display).to.equal('none'); el.handleSearchChange({target: {value: ''}} as unknown as Event); await nextFrame(); expect(el.querySelector('#veg')!.style.display).to.equal(''); }); });