import { beChecked, notBeChecked, haveAttribute, haveData, haveText, test, beVisible, notBeVisible, html } from '../../utils' test('data modified in event listener updates affected attribute bindings', html`
`, ({ get }) => { get('span').should(haveAttribute('foo', 'bar')) get('button').click() get('span').should(haveAttribute('foo', 'baz')) } ) test('can call a method without parenthesis', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('lob')) } ) test('event object is not passed if other params are present', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('foo')) } ) test('nested data modified in event listener updates affected attribute bindings', html`
`, ({ get }) => { get('span').should(haveAttribute('foo', 'bar')) get('button').click() get('span').should(haveAttribute('foo', 'baz')) } ) test('.passive modifier should disable e.preventDefault()', html`
`, ({ get }) => { get('button').click() get('div').should(haveData('defaultPrevented', false)) } ) test('.stop modifier', html`
`, ({ get }) => { get('div').should(haveData('foo', 'bar')) get('h2').click() get('div').should(haveData('foo', 'bar')) get('h1').click() get('div').should(haveData('foo', 'baz')) } ) test('.stop modifier with a .throttle', html`
`, ({ get }) => { get('div').should(haveData('foo', 'bar')) get('h2').click() get('h2').click() get('div').should(haveData('foo', 'bar')) get('h1').click() get('div').should(haveData('foo', 'baz')) } ) test('.capture modifier', html`
`, ({ get }) => { get('div').should(haveData('foo', 'bar')) get('h2').click() get('div').should(haveData('foo', 'bob')) get('div').should(haveData('count', 1)) } ) test('.capture modifier with @keyup', html`
`, ({ get }) => { get('div').should(haveData('foo', 'bar')) get('input').type('f') get('div').should(haveData('foo', 'input')) get('div').should(haveData('count', 1)) } ) test('.capture modifier with @keyup and specified key', html`
`, ({ get }) => { get('div').should(haveData('foo', 'bar')) get('input').type('{enter}') get('div').should(haveData('foo', 'input')) get('div').should(haveData('count', 1)) } ) test('.self modifier', html`

content content

`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('bar')) get('h1').click() get('span').should(haveText('baz')) } ) test( ".self.once modifiers", html`

content content

`, ({ get }) => { get("span").should(haveText("bar")); get("button").click(); get("span").should(haveText("bar")); get("h1").click(); get("span").should(haveText("baz")); } ); test('.prevent modifier', html`
`, ({ get }) => { get('input').check() get('input').should(notBeChecked()) } ) test('.prevent modifier with a .debounce', html`
`, ({ get }) => { get('input').check() get('input').check() get('input').should(notBeChecked()) } ) test('.window modifier', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('span').click() get('span').should(haveText('baz')) } ) test('expressions can start with if', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('unbind global event handler when element is removed', html`
`, ({ get }) => { get('button').click() get('span').click() get('span').should(haveText('1')) } ) test('.document modifier', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('span').click() get('span').should(haveText('baz')) } ) test('.once modifier', html`
`, ({ get }) => { get('span').should(haveText('0')) get('button').click() get('span').should(haveText('1')) get('button').click() get('span').should(haveText('1')) } ) test('.once modifier with @keyup', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('1')) get('input').type('o') get('span').should(haveText('1')) } ) test('.once modifier with @keyup and specified key', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('0')) get('input').type('{enter}') get('span').should(haveText('1')) get('input').type('{enter}') get('span').should(haveText('1')) } ) test('.debounce modifier', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('1')) get('input').type('ffffffffffff') get('span').should(haveText('2')) } ) test('.throttle modifier', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('1')) get('input').type('ffffffffffff') get('span').should(haveText('1')) } ) test('keydown modifiers', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('1')) get('input').type('{enter}') get('span').should(haveText('3')) get('input').type(' ') get('span').should(haveText('5')) get('input').type('{leftarrow}') get('span').should(haveText('7')) get('input').type('{rightarrow}') get('span').should(haveText('9')) get('input').type('{uparrow}') get('span').should(haveText('11')) get('input').type('{downarrow}') get('span').should(haveText('13')) get('input').type('{meta}') get('span').should(haveText('16')) get('input').type('{esc}') get('span').should(haveText('19')) get('input').type('{ctrl}') get('span').should(haveText('21')) get('input').type('/') get('span').should(haveText('23')) get('input').type('=') get('span').should(haveText('25')) get('input').type('.') get('span').should(haveText('27')) } ) test('discerns between space minus underscore', html`
`, ({get}) => { get('span').should(haveText('0')) get('#space').type(' ') get('span').should(haveText('1')) get('#space').type('-') get('span').should(haveText('1')) get('#minus').type('-') get('span').should(haveText('2')) get('#minus').type(' ') get('span').should(haveText('2')) get('#underscore').type('_') get('span').should(haveText('3')) get('#underscore').type(' ') get('span').should(haveText('3')) }) test('keydown combo modifiers', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('0')) get('input').type('{cmd}{enter}') get('span').should(haveText('1')) } ) test('keydown with specified key and stop modifier only stops for specified key', html`
`, ({ get }) => { get('span').should(haveText('0')) get('input').type('f') get('span').should(haveText('1')) get('input').type('{enter}') get('span').should(haveText('1')) } ) test('@click.away', html`

h1

h2

`, ({ get }) => { get('span').should(haveText('bar')) get('h1').click() get('span').should(haveText('bar')) get('h2').click() get('span').should(haveText('baz')) } ) test('@click.away.once works after clicking inside', html`

h1

h2

`, ({ get }) => { get('span').should(haveText('bar')) get('h1').click() get('span').should(haveText('bar')) get('h2').click() get('span').should(haveText('baz')) } ) test('@click.away with x-show (prevent race condition)', html`

h1

h2

`, ({ get }) => { get('h1').should(notBeVisible()) get('button').click() get('h1').should(beVisible()) } ) test('event with colon', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('event instance can be passed to method reference', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('.camel modifier correctly binds event listener', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('.camel modifier correctly binds event listener with namespace', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('.dot modifier correctly binds event listener', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('underscores are allowed in event names', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('.dot modifier correctly binds event listener with namespace', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('button').click() get('span').should(haveText('baz')) } ) test('handles await in handlers with invalid right hand expressions', html`
`, ({ get }) => { get('span').should(haveText('original')) get('button').click() get('span').should(haveText('new string')) } )