|
@@ -512,8 +512,9 @@ test('attribute binding names can contain numbers', async () => {
|
|
|
|
|
|
test('non-string and non-boolean attributes are cast to string when bound to checkbox', () => {
|
|
test('non-string and non-boolean attributes are cast to string when bound to checkbox', () => {
|
|
document.body.innerHTML = `
|
|
document.body.innerHTML = `
|
|
- <div x-data="{ number: 100, bool: true, nullProp: null }">
|
|
|
|
|
|
+ <div x-data="{ number: 100, zero: 0, bool: true, nullProp: null }">
|
|
<input type="checkbox" id="number" :value="number">
|
|
<input type="checkbox" id="number" :value="number">
|
|
|
|
+ <input type="checkbox" id="zero" :value="zero">
|
|
<input type="checkbox" id="boolean" :value="bool">
|
|
<input type="checkbox" id="boolean" :value="bool">
|
|
<input type="checkbox" id="null" :value="nullProp">
|
|
<input type="checkbox" id="null" :value="nullProp">
|
|
</div>
|
|
</div>
|
|
@@ -522,6 +523,7 @@ test('non-string and non-boolean attributes are cast to string when bound to che
|
|
Alpine.start()
|
|
Alpine.start()
|
|
|
|
|
|
expect(document.querySelector('#number').value).toEqual('100')
|
|
expect(document.querySelector('#number').value).toEqual('100')
|
|
|
|
+ expect(document.querySelector('#zero').value).toEqual('0')
|
|
expect(document.querySelector('#boolean').value).toEqual('on')
|
|
expect(document.querySelector('#boolean').value).toEqual('on')
|
|
expect(document.querySelector('#null').value).toEqual('on')
|
|
expect(document.querySelector('#null').value).toEqual('on')
|
|
})
|
|
})
|