wcb/test/e2e/on-changes.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

23 lines
902 B
JavaScript

import { beforeEach, expect, test } from 'vitest'
import '../../demo/examples/on-changes/index.js'
beforeEach(() => {
document.body.innerHTML = ''
})
test('onChanges payload separates camelCase property from kebab attribute', () => {
document.body.innerHTML = '<change-logger></change-logger>'
const el = document.querySelector('change-logger')
// nothing has changed yet
expect(el.querySelector('#no-changes')).toBeTruthy()
expect(el.querySelector('#greeting').textContent.trim()).toBe('Hello World')
el.querySelector('#rename').click()
expect(el.querySelector('#property').textContent).toBe('myName')
expect(el.querySelector('#attribute').textContent).toBe('my-name')
expect(el.querySelector('#previous').textContent).toBe('World')
expect(el.querySelector('#current').textContent).toBe('Ayo')
expect(el.querySelector('#greeting').textContent.trim()).toBe('Hello Ayo')
})