import { expect, fixture } from '@open-wc/testing'; import { isVisible } from '../../src/utils/is-visible.js'; describe('isVisible()', () => { it('returns true for static block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( `
`, )); expect(isVisible(element)).to.equal(true); }); it('returns false for hidden static block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( ``, )); expect(isVisible(element)).to.equal(false); }); it('returns true for relative block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( ``, )); expect(isVisible(element)).to.equal(true); }); it('returns false for hidden relative block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( ``, )); expect(isVisible(element)).to.equal(false); }); it('returns true for absolute block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture(` `)); expect(isVisible(element)).to.equal(true); }); it('returns false for hidden absolute block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture(` `)); expect(isVisible(element)).to.equal(false); }); it('returns true for relative block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture(` `)); expect(isVisible(element)).to.equal(true); }); it('returns true for relative block elements', async () => { const element = /** @type {HTMLElement} */ (await fixture(` `)); expect(isVisible(element)).to.equal(false); }); it('returns true for inline elements', async () => { const element = /** @type {HTMLElement} */ (await fixture(`Inline content`)); expect(isVisible(element)).to.equal(true); }); it('returns true for inline elements without content', async () => { const element = /** @type {HTMLElement} */ (await fixture(``)); expect(isVisible(element)).to.equal(true); }); it('returns true for static block elements with 0 dimensions', async () => { const element = /** @type {HTMLElement} */ (await fixture( ``, )); expect(isVisible(element)).to.equal(true); }); it('returns false for hidden inline elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( `Inline content`, )); expect(isVisible(element)).to.equal(false); }); it('returns false invisible elements', async () => { const element = /** @type {HTMLElement} */ (await fixture( ``, )); expect(isVisible(element)).to.equal(false); }); it('returns false when hidden by parent', async () => { const element = /** @type {HTMLElement} */ (await fixture(`