import { haveText, html, test } from '../../utils' test('$watch', html`

`, ({ get }) => { get('h1').should(haveText('bar')) get('h2').should(haveText('lob')) get('button').click() get('h1').should(haveText('baz')) get('h2').should(haveText('baz')) } ) test('$watch receives old value', html`

`, ({ get }) => { get('button').click() get('h1').should(haveText('baz')) get('h2').should(haveText('bar')) } ) test('$watch nested properties', html`

`, ({ get }) => { get('h1').should(haveText('baz')) get('h2').should(haveText('lob')) get('button').click() get('h1').should(haveText('law')) get('h2').should(haveText('law')) } ) test('$watch arrays', html`

`, ({ get }) => { get('h1').should(haveText('one')) get('h2').should(haveText('lob')) get('button#push').click() get('h1').should(haveText('one,two')) get('h2').should(haveText('one,two')) get('button#pop').click() get('h1').should(haveText('one')) get('h2').should(haveText('one')) get('button#unshift').click() get('h1').should(haveText('zero,one')) get('h2').should(haveText('zero,one')) get('button#shift').click() get('h1').should(haveText('one')) get('h2').should(haveText('one')) get('button#assign').click() get('h1').should(haveText('2,1,3')) get('h2').should(haveText('2,1,3')) get('button#sort').click() get('h1').should(haveText('1,2,3')) get('h2').should(haveText('1,2,3')) get('button#reverse').click() get('h1').should(haveText('3,2,1')) get('h2').should(haveText('3,2,1')) } ) test('$watch nested arrays', html`

`, ({ get }) => { get('h1').should(haveText('one')) get('h2').should(haveText('lob')) get('button').click() get('h1').should(haveText('one,two')) get('h2').should(haveText('one,two')) } ) test('$watch ignores other dependencies', html`
`, ({ get }) => { get('span').should(haveText('0')) get('#a').click() get('span').should(haveText('1')) get('#b').click() get('span').should(haveText('1')) } )