import { expect, fixture, html } from '@open-wc/testing';
import './nile-section-message';
import type { NileSectionMessage } from './nile-section-message';
describe('NileSectionMessage', () => {
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-section-message'); });
it('4. heading defaults empty', async () => { const el = await fixture(html``); expect(el.heading).to.equal(''); });
it('5. description defaults empty', async () => { const el = await fixture(html``); expect(el.description).to.equal(''); });
it('6. iconSize defaults 16', async () => { const el = await fixture(html``); expect(el.iconSize).to.equal(16); });
it('7. variant defaults primary', async () => { const el = await fixture(html``); expect(el.variant).to.equal('primary'); });
it('8. set heading', async () => { const el = await fixture(html``); expect(el.heading).to.equal('Info'); });
it('9. set description', async () => { const el = await fixture(html``); expect(el.description).to.equal('Details'); });
it('10. set variant success', async () => { const el = await fixture(html``); expect(el.variant).to.equal('success'); });
it('11. set variant warning', async () => { const el = await fixture(html``); expect(el.variant).to.equal('warning'); });
it('12. set variant error', async () => { const el = await fixture(html``); expect(el.variant).to.equal('error'); });
it('13. parent__wrapper class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.parent__wrapper')).to.exist; });
it('14. section--primary class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section--primary')).to.exist; });
it('15. section--success class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section--success')).to.exist; });
it('16. section--warning class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section--warning')).to.exist; });
it('17. section--error class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section--error')).to.exist; });
it('18. left__wrapper class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.left__wrapper')).to.exist; });
it('19. right__wrapper class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.right__wrapper')).to.exist; });
it('20. icon--primary class', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.icon--primary')).to.exist; });
it('21. part parent__wrapper', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="parent__wrapper"]')).to.exist; });
it('22. part icon__wrapper', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="icon__wrapper"]')).to.exist; });
it('23. part content__wrapper', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('[part="content__wrapper"]')).to.exist; });
it('24. heading displayed', async () => { const el = await fixture(html``); expect(el.shadowRoot!.textContent).to.contain('Info'); });
it('25. description displayed', async () => { const el = await fixture(html``); expect(el.shadowRoot!.textContent).to.contain('Details'); });
it('26. nile-icon-button', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('nile-icon-button')).to.exist; });
it('27. icon slot', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('slot[name="icon"]')).to.exist; });
it('28. heading slot when heading set', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('slot[name="section__heading"]')).to.exist; });
it('29. description slot when description set', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('slot[name="section__description"]')).to.exist; });
it('30. iconMap', async () => { const el = await fixture(html``); expect(el.iconMap).to.exist; expect(el.iconMap.primary).to.exist; });
it('31. has styles', async () => { expect((await import('./nile-section-message')).NileSectionMessage.styles).to.exist; });
it('32. is defined', async () => { expect(customElements.get('nile-section-message')).to.exist; });
it('33. shadow mode', async () => { const el = await fixture(html``); expect(el.shadowRoot!.mode).to.equal('open'); });
it('34. isConnected', async () => { const el = await fixture(html``); expect(el.isConnected).to.be.true; });
it('35. removal', async () => { const el = await fixture(html``); el.remove(); expect(el.isConnected).to.be.false; });
it('36. outerHTML', async () => { const el = await fixture(html``); expect(el.outerHTML).to.contain('nile-section-message'); });
it('37. matches', async () => { const el = await fixture(html``); expect(el.matches('.x')).to.be.true; });
it('38. closest', async () => { const el = await fixture(html``); expect(el.closest('nile-section-message')).to.equal(el); });
it('39. cloneNode', async () => { const el = await fixture(html``); expect((el.cloneNode(true) as Element).tagName.toLowerCase()).to.equal('nile-section-message'); });
it('40. 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('41. updateComplete', async () => { const el = await fixture(html``); const r = await el.updateComplete; expect(r).to.not.be.undefined; });
it('42. render method', async () => { const el = await fixture(html``); expect(el.render).to.be.a('function'); });
it('43. shadowRoot host', async () => { const el = await fixture(html``); expect(el.shadowRoot!.host).to.equal(el); });
it('44. class attr', async () => { const el = await fixture(html``); expect(el.classList.contains('sm')).to.be.true; });
it('45. id attr', async () => { const el = await fixture(html``); expect(el.id).to.equal('sm1'); });
it('46. hidden', async () => { const el = await fixture(html``); expect(el.hidden).to.be.true; });
it('47. nodeType', async () => { const el = await fixture(html``); expect(el.nodeType).to.equal(1); });
it('48. localName', async () => { const el = await fixture(html``); expect(el.localName).to.equal('nile-section-message'); });
it('49. namespaceURI', async () => { const el = await fixture(html``); expect(el.namespaceURI).to.equal('http://www.w3.org/1999/xhtml'); });
it('50. ownerDocument', async () => { const el = await fixture(html``); expect(el.ownerDocument).to.equal(document); });
it('51. dynamic heading', async () => { const el = await fixture(html``); el.heading = 'New'; await el.updateComplete; expect(el.shadowRoot!.textContent).to.contain('New'); });
it('52. dynamic description', async () => { const el = await fixture(html``); el.description = 'Desc'; await el.updateComplete; expect(el.shadowRoot!.textContent).to.contain('Desc'); });
it('53. dynamic variant', async () => { const el = await fixture(html``); el.variant = 'error'; await el.updateComplete; expect(el.shadowRoot!.querySelector('.section--error')).to.exist; });
it('54. multiple instances', async () => { const c = await fixture(html`
`); expect(c.querySelectorAll('nile-section-message').length).to.equal(2); });
it('55. parent-child', async () => { const c = await fixture(html`
`); expect(c.querySelector('nile-section-message')!.parentElement).to.equal(c); });
it('56. createElement', async () => { const el = document.createElement('nile-section-message') as NileSectionMessage; document.body.appendChild(el); await el.updateComplete; expect(el.shadowRoot).to.not.be.null; document.body.removeChild(el); });
it('57. dataset', async () => { const el = await fixture(html``); expect(el.dataset.idx).to.equal('0'); });
it('58. classList add', async () => { const el = await fixture(html``); el.classList.add('z'); expect(el.classList.contains('z')).to.be.true; });
it('59. getBoundingClientRect', async () => { const el = await fixture(html``); expect(el.getBoundingClientRect()).to.exist; });
it('60. no form', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('form')).to.be.null; });
it('61. no input', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('input')).to.be.null; });
it('62. no button', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('button')).to.be.null; });
it('63. no anchor', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('a')).to.be.null; });
it('64. no img', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('img')).to.be.null; });
it('65. no svg', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('svg')).to.be.null; });
it('66. style attr', async () => { const el = await fixture(html``); expect(el.style.color).to.equal('red'); });
it('67. data attr', async () => { const el = await fixture(html``); expect(el.getAttribute('data-x')).to.equal('1'); });
it('68. aria-label', async () => { const el = await fixture(html``); expect(el.getAttribute('aria-label')).to.equal('Alert'); });
it('69. role', async () => { const el = await fixture(html``); expect(el.getAttribute('role')).to.equal('alert'); });
it('70. dir', async () => { const el = await fixture(html``); expect(el.dir).to.equal('rtl'); });
it('71. title attr', async () => { const el = await fixture(html``); expect(el.title).to.equal('SM'); });
it('72. lang attr', async () => { const el = await fixture(html``); expect(el.lang).to.equal('en'); });
it('73. tabindex', async () => { const el = await fixture(html``); expect(el.getAttribute('tabindex')).to.equal('0'); });
it('74. requestUpdate', async () => { const el = await fixture(html``); el.requestUpdate(); await el.updateComplete; expect(el.shadowRoot).to.not.be.null; });
it('75. shadow childNodes', async () => { const el = await fixture(html``); expect(el.shadowRoot!.childNodes.length).to.be.greaterThan(0); });
it('76. scrollIntoView', async () => { const el = await fixture(html``); expect(el.scrollIntoView).to.be.a('function'); });
it('77. focus method', async () => { const el = await fixture(html``); expect(el.focus).to.be.a('function'); });
it('78. blur method', async () => { const el = await fixture(html``); expect(el.blur).to.be.a('function'); });
it('79. class toggle', async () => { const el = await fixture(html``); el.classList.toggle('a'); expect(el.classList.contains('a')).to.be.true; });
it('80. toggle hidden', async () => { const el = await fixture(html``); el.hidden = true; expect(el.hidden).to.be.true; });
it('81. 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('82. nested in div', async () => { const c = await fixture(html`
`); expect(c.querySelector('nile-section-message')).to.exist; });
it('83. no table', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('table')).to.be.null; });
it('84. no ul', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('ul')).to.be.null; });
it('85. no canvas', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('canvas')).to.be.null; });
it('86. no video', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('video')).to.be.null; });
it('87. no audio', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('audio')).to.be.null; });
it('88. no nav', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('nav')).to.be.null; });
it('89. no aside', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('aside')).to.be.null; });
it('90. no textarea', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('textarea')).to.be.null; });
it('91. no select', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('select')).to.be.null; });
it('92. setAttribute data', async () => { const el = await fixture(html``); el.setAttribute('data-test', '1'); expect(el.dataset.test).to.equal('1'); });
it('93. removeAttribute hidden', async () => { const el = await fixture(html``); el.removeAttribute('hidden'); expect(el.hidden).to.be.false; });
it('94. setAttribute class', async () => { const el = await fixture(html``); el.setAttribute('class', 'test'); expect(el.classList.contains('test')).to.be.true; });
it('95. aria-describedby', async () => { const el = await fixture(html``); expect(el.getAttribute('aria-describedby')).to.equal('d'); });
it('96. multiple re-renders', async () => { const el = await fixture(html``); for (let i = 0; i < 3; i++) { el.requestUpdate(); await el.updateComplete; } expect(el.shadowRoot).to.not.be.null; });
it('97. no heading slot without heading', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section__heading')).to.be.null; });
it('98. no description slot without description', async () => { const el = await fixture(html``); expect(el.shadowRoot!.querySelector('.section__description')).to.be.null; });
it('99. iconMap has all variants', async () => { const el = await fixture(html``); expect(el.iconMap.primary).to.exist; expect(el.iconMap.success).to.exist; expect(el.iconMap.warning).to.exist; expect(el.iconMap.error).to.exist; });
it('100. full integration', async () => { const el = await fixture(html``); expect(el.heading).to.equal('Info'); expect(el.description).to.equal('Details here'); expect(el.variant).to.equal('success'); expect(el.iconSize).to.equal(20); expect(el.id).to.equal('sm1'); expect(el.shadowRoot!.querySelector('.section--success')).to.exist; expect(el.shadowRoot!.textContent).to.contain('Info'); expect(el.shadowRoot!.textContent).to.contain('Details here'); });
});