import { haveData, haveText, haveValue, html, test } from '../../utils' test('The name of the test', html`

`, ({ get }) => get('h1').should(haveText('HEY')) ) test('x-model has value binding when initialized', html`
`, ({ get }) => { get('input').should(haveValue('bar')) } ) test('x-model updates value when updated via input event', html`
`, ({ get }) => { get('span').should(haveText('bar')) get('input').type('baz') get('span').should(haveText('barbaz')) } ) test('x-model has value binding when updated', html`
`, ({ get }) => { get('input').should(haveValue('bar')) get('button').click() get('input').should(haveValue('baz')) } ) test('x-model casts value to number if number modifier is present', html`
`, ({ get }) => { get('input').type('123') get('div').should(haveData('foo', 123)) } ) test('x-model with number modifier returns: null if empty, original value if casting fails, numeric value if casting passes', html`
`, ({ get }) => { get('input:nth-of-type(1)').clear() get('div').should(haveData('foo', null)) get('input:nth-of-type(1)').clear().type('-') get('div').should(haveData('foo', null)) get('input:nth-of-type(1)').clear().type('-123') get('div').should(haveData('foo', -123)) get('input:nth-of-type(2)').type(123).clear() get('div').should(haveData('bar', null)) get('input:nth-of-type(2)').clear().type('-') get('div').should(haveData('bar', '-')) get('input:nth-of-type(2)').clear().type('-123') get('div').should(haveData('bar', -123)) } ) test('x-model trims value if trim modifier is present', html`
`, ({ get }) => { get('input').type('bar ') get('div').should(haveData('foo', 'bar')) } )