|
@@ -1,4 +1,4 @@
|
|
|
-import { haveData, haveText, haveValue, html, test } from '../../utils'
|
|
|
+import { beChecked, haveData, haveText, haveValue, html, notBeChecked, test } from '../../utils'
|
|
|
|
|
|
test('The name of the test',
|
|
|
html`<h1 x-data x-text="'HEY'"></h1>`,
|
|
@@ -79,6 +79,24 @@ test('x-model with number modifier returns: null if empty, original value if cas
|
|
|
}
|
|
|
)
|
|
|
|
|
|
+test('x-model casts value to boolean initially for radios',
|
|
|
+ html`
|
|
|
+ <div x-data="{ foo: true }">
|
|
|
+ <input id="1" type="radio" value="true" name="foo" x-model.boolean="foo">
|
|
|
+ <input id="2" type="radio" value="false" name="foo" x-model.boolean="foo">
|
|
|
+ </div>
|
|
|
+ `,
|
|
|
+ ({ get }) => {
|
|
|
+ get('div').should(haveData('foo', true))
|
|
|
+ get('#1').should(beChecked())
|
|
|
+ get('#2').should(notBeChecked())
|
|
|
+ get('#2').click()
|
|
|
+ get('div').should(haveData('foo', false))
|
|
|
+ get('#1').should(notBeChecked())
|
|
|
+ get('#2').should(beChecked())
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
test('x-model casts value to boolean if boolean modifier is present',
|
|
|
html`
|
|
|
<div x-data="{ foo: null, bar: null, baz: [] }">
|