$root.spec.js 419 B

1234567891011121314
  1. import { haveText, html, test } from '../../utils'
  2. test('$root returns the root element of the component',
  3. html`
  4. <div x-data data-message="foo">
  5. <button @click="$el.innerText = $root.dataset.message">click me</button>
  6. </div>
  7. `,
  8. ({ get }) => {
  9. get('button').should(haveText('click me'))
  10. get('button').click()
  11. get('button').should(haveText('foo'))
  12. }
  13. )