|
@@ -97,6 +97,24 @@ test('.window modifier', async () => {
|
|
|
await wait(() => { expect(document.querySelector('span').getAttribute('foo')).toEqual('baz') })
|
|
|
})
|
|
|
|
|
|
+test('.document modifier', async () => {
|
|
|
+ document.body.innerHTML = `
|
|
|
+ <div x-data="{ foo: 'bar' }">
|
|
|
+ <div x-on:click.document="foo = 'baz'"></div>
|
|
|
+
|
|
|
+ <span x-bind:foo="foo"></span>
|
|
|
+ </div>
|
|
|
+ `
|
|
|
+
|
|
|
+ Alpine.start()
|
|
|
+
|
|
|
+ expect(document.querySelector('span').getAttribute('foo')).toEqual('bar')
|
|
|
+
|
|
|
+ document.body.click()
|
|
|
+
|
|
|
+ await wait(() => { expect(document.querySelector('span').getAttribute('foo')).toEqual('baz') })
|
|
|
+})
|
|
|
+
|
|
|
test('.once modifier', async () => {
|
|
|
document.body.innerHTML = `
|
|
|
<div x-data="{ count: 0 }">
|