import { expect, fixture, html } from '@open-wc/testing';
import './nile-empty-state';
import type { NileEmptyState } from './nile-empty-state';
describe('NileEmptyState', () => {
it('1. renders', async () => { const el = await fixture(html``); expect(el).to.exist; });
it('2. shadow root', async () => { const el = await fixture(html``); expect(el.shadowRoot).to.not.be.null; });
it('3. tag name', async () => { const el = await fixture(html``); expect(el.tagName.toLowerCase()).to.equal('nile-empty-state'); });
it('4. size defaults md', async () => { const el = await fixture(html``); expect(el.size).to.equal('md'); });
it('5. variant defaults tonal', async () => { const el = await fixture(html``); expect(el.variant).to.equal('tonal'); });
it('6. text default', async () => { const el = await fixture(html``); expect(el.text).to.equal('Empty State'); });
it('7. subText default', async () => { const el = await fixture(html``); expect(el.subText).to.equal('No Data'); });
it('8. grayscale defaults false', async () => { const el = await fixture(html``); expect(el.grayscale).to.be.false; });
it('9. svgIconSize defaults 40', async () => { const el = await fixture(html``); expect(el.svgIconSize).to.equal(40); });
it('10. container part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="container"]')).to.exist; });
it('11. body part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="body"]')).to.exist; });
it('12. text part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="text"]')).to.exist; });
it('13. subtitle part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="subtitle"]')).to.exist; });
it('14. actions part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="actions"]')).to.exist; });
it('15. text-section part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="text-section"]')).to.exist; });
it('16. empty-state class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state')).to.exist; });
it('17. sm class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state--sm')).to.exist; });
it('18. md class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state--md')).to.exist; });
it('19. lg class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state--lg')).to.exist; });
it('20. tonal body', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--tonal')).to.exist; });
it('21. content body', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--content')).to.exist; });
it('22. flat body', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--flat')).to.exist; });
it('23. text displayed', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__text')!.textContent).to.contain('Nothing here'); });
it('24. subText displayed', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__subtext')!.textContent).to.contain('Try again'); });
it('25. nile-icon in tonal', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('nile-icon')).to.exist; });
it('26. nile-icon in content', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('nile-icon')).to.exist; });
it('27. nile-icon in flat', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('nile-icon')).to.exist; });
it('28. slot', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('slot')).to.exist; });
it('29. slotted content', async () => { const el = await fixture(html``); expect(el.querySelector('button')).to.exist; });
it('30. dynamic text', async () => { const el = await fixture(html``); el.text = 'New Text'; await el.updateComplete; expect(el.shadowRoot!.querySelector('.empty-state__text')!.textContent).to.contain('New Text'); });
it('31. dynamic subText', async () => { const el = await fixture(html``); el.subText = 'New Sub'; await el.updateComplete; expect(el.shadowRoot!.querySelector('.empty-state__subtext')!.textContent).to.contain('New Sub'); });
it('32. dynamic variant', async () => { const el = await fixture(html``); el.variant = 'flat'; await el.updateComplete; expect(el.shadowRoot!.querySelector('.empty-state__body--flat')).to.exist; });
it('33. dynamic size', async () => { const el = await fixture(html``); el.size = 'lg'; await el.updateComplete; expect(el.shadowRoot!.querySelector('.empty-state--lg')).to.exist; });
it('34. has styles', async () => { expect((await import('./nile-empty-state')).NileEmptyState.styles).to.exist; });
it('35. is defined', async () => { expect(customElements.get('nile-empty-state')).to.exist; });
it('36. shadow mode', async () => { const el = await fixture(html``); expect(el.shadowRoot!.mode).to.equal('open'); });
it('37. isConnected', async () => { const el = await fixture(html``); expect(el.isConnected).to.be.true; });
it('38. removal', async () => { const el = await fixture(html``); el.remove(); expect(el.isConnected).to.be.false; });
it('39. outerHTML', async () => { const el = await fixture(html``); expect(el.outerHTML).to.contain('nile-empty-state'); });
it('40. matches', async () => { const el = await fixture(html``); expect(el.matches('nile-empty-state.x')).to.be.true; });
it('41. closest', async () => { const el = await fixture(html``); expect(el.closest('nile-empty-state')).to.equal(el); });
it('42. cloneNode', async () => { const el = await fixture(html``); expect((el.cloneNode(true) as Element).tagName.toLowerCase()).to.equal('nile-empty-state'); });
it('43. dispatchEvent', async () => { const el = await fixture(html``); let f = false; el.addEventListener('c', () => (f = true)); el.dispatchEvent(new Event('c')); expect(f).to.be.true; });
it('44. updateComplete', async () => { const el = await fixture(html``); const r = await el.updateComplete; expect(r).to.not.be.undefined; });
it('45. requestUpdate', async () => { const el = await fixture(html``); el.requestUpdate(); await el.updateComplete; expect(el.shadowRoot).to.not.be.null; });
it('46. render method', async () => { const el = await fixture(html``); expect(el.render).to.be.a('function'); });
it('47. shadowRoot host', async () => { const el = await fixture(html``); expect(el.shadowRoot!.host).to.equal(el); });
it('48. class attr', async () => { const el = await fixture(html``); expect(el.classList.contains('e')).to.be.true; });
it('49. id attr', async () => { const el = await fixture(html``); expect(el.id).to.equal('e1'); });
it('50. style attr', async () => { const el = await fixture(html``); expect(el.style.color).to.equal('red'); });
it('51. data attr', async () => { const el = await fixture(html``); expect(el.getAttribute('data-x')).to.equal('1'); });
it('52. hidden', async () => { const el = await fixture(html``); expect(el.hidden).to.be.true; });
it('53. dir', async () => { const el = await fixture(html``); expect(el.dir).to.equal('rtl'); });
it('54. nodeType', async () => { const el = await fixture(html``); expect(el.nodeType).to.equal(1); });
it('55. multiple instances', async () => { const c = await fixture(html`
`); expect(c.querySelectorAll('nile-empty-state').length).to.equal(2); });
it('56. parent-child', async () => { const c = await fixture(html`
`); expect(c.querySelector('nile-empty-state')!.parentElement).to.equal(c); });
it('57. localName', async () => { const el = await fixture(html``); expect(el.localName).to.equal('nile-empty-state'); });
it('58. namespaceURI', async () => { const el = await fixture(html``); expect(el.namespaceURI).to.equal('http://www.w3.org/1999/xhtml'); });
it('59. ownerDocument', async () => { const el = await fixture(html``); expect(el.ownerDocument).to.equal(document); });
it('60. icon default', async () => { const el = await fixture(html``); expect(el.icon).to.contain('nile-icon-error'); });
it('61. custom icon', async () => { const el = await fixture(html``); expect(el.icon).to.equal('star'); });
it('62. actions class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state-actions')).to.exist; });
it('63. empty-state__body class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body')).to.exist; });
it('64. text-section class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty__state__text-section')).to.exist; });
it('65. sub-text attr', async () => { const el = await fixture(html``); expect(el.subText).to.equal('Nope'); });
it('66. tonal-body part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="tonal-body"]')).to.exist; });
it('67. content-image part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="content-image"]')).to.exist; });
it('68. flat-body part', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="flat-body"]')).to.exist; });
it('69. no tonal in flat', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--tonal')).to.be.null; });
it('70. no content in tonal', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--content')).to.be.null; });
it('71. no flat in content', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__body--flat')).to.be.null; });
it('72. icon-wrapper part content', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="icon-wrapper"]')).to.exist; });
it('73. classList add', async () => { const el = await fixture(html``); el.classList.add('z'); expect(el.classList.contains('z')).to.be.true; });
it('74. dataset', async () => { const el = await fixture(html``); expect(el.dataset.idx).to.equal('0'); });
it('75. getBoundingClientRect', async () => { const el = await fixture(html``); expect(el.getBoundingClientRect()).to.exist; });
it('76. size type string', async () => { const el = await fixture(html``); expect(typeof el.size).to.equal('string'); });
it('77. variant type string', async () => { const el = await fixture(html``); expect(typeof el.variant).to.equal('string'); });
it('78. grayscale type boolean', async () => { const el = await fixture(html``); expect(typeof el.grayscale).to.equal('boolean'); });
it('79. svgIconSize type number', async () => { const el = await fixture(html``); expect(typeof el.svgIconSize).to.equal('number'); });
it('80. createElement', async () => { const el = document.createElement('nile-empty-state') as NileEmptyState; document.body.appendChild(el); await el.updateComplete; expect(el.shadowRoot).to.not.be.null; document.body.removeChild(el); });
it('81. aria-label', async () => { const el = await fixture(html``); expect(el.getAttribute('aria-label')).to.equal('Empty'); });
it('82. role', async () => { const el = await fixture(html``); expect(el.getAttribute('role')).to.equal('status'); });
it('83. rapid variant changes', async () => { const el = await fixture(html``); for (const v of ['flat', 'content', 'tonal'] as const) { el.variant = v; await el.updateComplete; } expect(el.variant).to.equal('tonal'); });
it('84. rapid size changes', async () => { const el = await fixture(html``); for (const s of ['sm', 'md', 'lg'] as const) { el.size = s; await el.updateComplete; } expect(el.size).to.equal('lg'); });
it('85. title attr', async () => { const el = await fixture(html``); expect(el.title).to.equal('E'); });
it('86. lang attr', async () => { const el = await fixture(html``); expect(el.lang).to.equal('en'); });
it('87. tabindex', async () => { const el = await fixture(html``); expect(el.getAttribute('tabindex')).to.equal('0'); });
it('88. no form', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('form')).to.be.null; });
it('89. no input', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('input')).to.be.null; });
it('90. flat icon class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.nile-flat-type-icon')).to.exist; });
it('91. content icon class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.empty-state__img__icon')).to.exist; });
it('92. children survived update', async () => { const el = await fixture(html``); el.text = 'Updated'; await el.updateComplete; expect(el.querySelector('#b1')).to.exist; });
it('93. dispatchCustomEvent', async () => { const el = await fixture(html``); let d: any; el.addEventListener('t', ((e: CustomEvent) => { d = e.detail; }) as EventListener); el.dispatchEvent(new CustomEvent('t', { detail: 'x' })); expect(d).to.equal('x'); });
it('94. scrollIntoView', async () => { const el = await fixture(html``); expect(el.scrollIntoView).to.be.a('function'); });
it('95. focus method', async () => { const el = await fixture(html``); expect(el.focus).to.be.a('function'); });
it('96. dynamic icon', async () => { const el = await fixture(html``); el.icon = 'star'; await el.updateComplete; const icon = el.shadowRoot!.querySelector('nile-icon'); expect(icon!.getAttribute('name')).to.equal('star'); });
it('97. svgIconUrl renders custom', async () => { const el = await fixture(html``); await el.updateComplete; const icon = el.shadowRoot!.querySelector('nile-icon'); expect(icon!.getAttribute('customsvgpath')).to.exist; });
it('98. svgIconSize applies', async () => { const el = await fixture(html``); await el.updateComplete; const icon = el.shadowRoot!.querySelector('nile-icon'); expect(icon!.getAttribute('size')).to.equal('60'); });
it('99. shadow childNodes', async () => { const el = await fixture(html``); expect(el.shadowRoot!.childNodes.length).to.be.greaterThan(0); });
it('100. full integration', async () => { const el = await fixture(html``); expect(el.text).to.equal('Empty'); expect(el.subText).to.equal('Nothing'); expect(el.variant).to.equal('content'); expect(el.size).to.equal('lg'); expect(el.icon).to.equal('star'); expect(el.id).to.equal('e1'); expect(el.querySelector('button')).to.exist; expect(el.shadowRoot!.querySelector('.empty-state--lg')).to.exist; });
});