import { haveText, html, test } from '../../utils' test('x-data attribute value is optional', html`
`, ({ get }) => get('span').should(haveText('foo')) ) test('x-data can be nested', html`

`, ({ get }) => { get('h1').should(haveText('bar')) get('h2').should(haveText('bob')) get('h3').should(haveText('bar')) get('h4').should(haveText('baz')) get('button#inner').click() get('h1').should(haveText('bob')) get('h2').should(haveText('lob')) get('h3').should(haveText('bob')) get('h4').should(haveText('baz')) get('button#outer').click() get('h1').should(haveText('law')) get('h2').should(haveText('lob')) get('h3').should(haveText('law')) get('h4').should(haveText('blog')) } ) test('x-data can use attributes from a reusable function', html`
`, ({ get }) => get('span').should(haveText('bar')) ) test('x-data can use $el', html`
`, ({ get }) => get('span').should(haveText('test')) ) test('functions in x-data are reactive', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('functions in x-data have access to proper this context', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('x-data works on the html tag', [html`
`, ` document.querySelector('html').setAttribute('x-data', '') `], ({ get }) => { get('span').should(haveText('foo')) } )