wcb/test/e2e/constructed-styles.test.mjs
Ayo ce30b114a2 chore: new demo workspace & e2e tests
- this adds a new demo web app with vite HMR for development
- all examples are covered with e2e tests
2026-07-05 15:40:53 +02:00

15 lines
562 B
JavaScript

import { beforeEach, expect, test } from 'vitest'
import '../../demo/examples/constructed-styles/index.js'
beforeEach(() => {
document.body.innerHTML = ''
})
test('applies a constructable stylesheet via adoptedStyleSheets in the shadow root', () => {
document.body.innerHTML = '<styled-elements></styled-elements>'
const el = document.querySelector('styled-elements')
expect(el.shadowRoot).toBeTruthy()
expect(el.shadowRoot.adoptedStyleSheets.length).toBeGreaterThan(0)
expect(el.shadowRoot.querySelector('p').textContent.trim()).toBe('Wow!?')
})