@@ -76,7 +76,7 @@ describe('Safe guards', () => {
76
76
suppressConsoleLogs ( async ( ) => {
77
77
renderTemplate (
78
78
`
79
- <Dialog :open="false" :onClose ="() => {}">
79
+ <Dialog :open="false" @close ="() => {}">
80
80
<button>Trigger</button>
81
81
<DialogOverlay />
82
82
<DialogTitle />
@@ -97,48 +97,16 @@ describe('Safe guards', () => {
97
97
describe ( 'Rendering' , ( ) => {
98
98
describe ( 'Dialog' , ( ) => {
99
99
it (
100
- 'should complain when the `open` and `onClose` prop are missing' ,
100
+ 'should complain when an `open` prop is missing' ,
101
101
suppressConsoleLogs ( async ( ) => {
102
102
expect ( ( ) =>
103
103
renderTemplate (
104
104
`
105
- <Dialog as="div" />
105
+ <Dialog as="div" @close="() => {}" />
106
106
`
107
107
)
108
108
) . toThrowErrorMatchingInlineSnapshot (
109
- `"You have to provide an \`open\` and an \`onClose\` prop to the \`Dialog\` component."`
110
- )
111
- expect . hasAssertions ( )
112
- } )
113
- )
114
-
115
- it (
116
- 'should complain when an `open` prop is provided without an `onClose` prop' ,
117
- suppressConsoleLogs ( async ( ) => {
118
- expect ( ( ) =>
119
- renderTemplate (
120
- `
121
- <Dialog as="div" :open="false" />
122
- `
123
- )
124
- ) . toThrowErrorMatchingInlineSnapshot (
125
- `"You provided an \`open\` prop to the \`Dialog\`, but forgot an \`onClose\` prop."`
126
- )
127
- expect . hasAssertions ( )
128
- } )
129
- )
130
-
131
- it (
132
- 'should complain when an `onClose` prop is provided without an `open` prop' ,
133
- suppressConsoleLogs ( async ( ) => {
134
- expect ( ( ) =>
135
- renderTemplate (
136
- `
137
- <Dialog as="div" :onClose="() => {}" />
138
- `
139
- )
140
- ) . toThrowErrorMatchingInlineSnapshot (
141
- `"You provided an \`onClose\` prop to the \`Dialog\`, but forgot an \`open\` prop."`
109
+ `"You forgot to provide an \`open\` prop to the \`Dialog\`."`
142
110
)
143
111
expect . hasAssertions ( )
144
112
} )
@@ -150,7 +118,7 @@ describe('Rendering', () => {
150
118
expect ( ( ) =>
151
119
renderTemplate (
152
120
`
153
- <Dialog as="div" :open="null" :onClose ="() => {}" />
121
+ <Dialog as="div" :open="null" @close ="() => {}" />
154
122
`
155
123
)
156
124
) . toThrowErrorMatchingInlineSnapshot (
@@ -160,22 +128,6 @@ describe('Rendering', () => {
160
128
} )
161
129
)
162
130
163
- it (
164
- 'should complain when an `onClose` prop is not a function' ,
165
- suppressConsoleLogs ( async ( ) => {
166
- expect ( ( ) =>
167
- renderTemplate (
168
- `
169
- <Dialog as="div" :open="false" :onClose="null" />
170
- `
171
- )
172
- ) . toThrowErrorMatchingInlineSnapshot (
173
- `"You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: null"`
174
- )
175
- expect . hasAssertions ( )
176
- } )
177
- )
178
-
179
131
it (
180
132
'should be possible to render a Dialog using a render prop' ,
181
133
suppressConsoleLogs ( async ( ) => {
@@ -185,7 +137,7 @@ describe('Rendering', () => {
185
137
<button id="trigger" @click="setIsOpen(true)">
186
138
Trigger
187
139
</button>
188
- <Dialog :open="isOpen" :onClose ="setIsOpen" v-slot="data">
140
+ <Dialog :open="isOpen" @close ="setIsOpen" v-slot="data">
189
141
<pre>{{JSON.stringify(data)}}</pre>
190
142
<TabSentinel />
191
143
</Dialog>
@@ -217,7 +169,7 @@ describe('Rendering', () => {
217
169
<button id="trigger" @click="setIsOpen(true)">
218
170
Trigger
219
171
</button>
220
- <Dialog :open="isOpen" :onClose ="setIsOpen" class="relative bg-blue-500">
172
+ <Dialog :open="isOpen" @close ="setIsOpen" class="relative bg-blue-500">
221
173
<TabSentinel />
222
174
</Dialog>
223
175
</div>
@@ -246,7 +198,7 @@ describe('Rendering', () => {
246
198
template : `
247
199
<div>
248
200
<button>Trigger</button>
249
- <Dialog :open="true" :onClose ="() => {}" static>
201
+ <Dialog :open="true" @close ="() => {}" static>
250
202
<p>Contents</p>
251
203
<TabSentinel @focus="focusCounter" />
252
204
</Dialog>
@@ -270,7 +222,7 @@ describe('Rendering', () => {
270
222
template : `
271
223
<div>
272
224
<button>Trigger</button>
273
- <Dialog :open="false" :onClose ="() => {}" static>
225
+ <Dialog :open="false" @close ="() => {}" static>
274
226
<p>Contents</p>
275
227
<TabSentinel @focus="focusCounter" />
276
228
</Dialog>
@@ -294,7 +246,7 @@ describe('Rendering', () => {
294
246
template : `
295
247
<div>
296
248
<button id="trigger" @click="isOpen = !isOpen">Trigger</button>
297
- <Dialog :open="isOpen" :onClose ="setIsOpen" :unmount="false">
249
+ <Dialog :open="isOpen" @close ="setIsOpen" :unmount="false">
298
250
<TabSentinel @focus="focusCounter" />
299
251
</Dialog>
300
252
</div>
@@ -340,7 +292,7 @@ describe('Rendering', () => {
340
292
Trigger
341
293
</button>
342
294
343
- <Dialog :open="isOpen" :onClose ="setIsOpen">
295
+ <Dialog :open="isOpen" @close ="setIsOpen">
344
296
<input id="a" type="text" />
345
297
<input id="b" type="text" />
346
298
<input id="c" type="text" />
@@ -385,7 +337,7 @@ describe('Rendering', () => {
385
337
<button id="trigger" @click="toggleOpen">
386
338
Trigger
387
339
</button>
388
- <Dialog :open="isOpen" :onClose ="setIsOpen">
340
+ <Dialog :open="isOpen" @close ="setIsOpen">
389
341
<DialogOverlay v-slot="data">{{JSON.stringify(data)}}</DialogOverlay>
390
342
<TabSentinel />
391
343
</Dialog>
@@ -427,7 +379,7 @@ describe('Rendering', () => {
427
379
suppressConsoleLogs ( async ( ) => {
428
380
renderTemplate (
429
381
`
430
- <Dialog :open="true" :onClose ="() => {}">
382
+ <Dialog :open="true" @close ="() => {}">
431
383
<DialogTitle v-slot="data">{{JSON.stringify(data)}}</DialogTitle>
432
384
<TabSentinel />
433
385
</Dialog>
@@ -454,7 +406,7 @@ describe('Rendering', () => {
454
406
suppressConsoleLogs ( async ( ) => {
455
407
renderTemplate (
456
408
`
457
- <Dialog :open="true" :onClose ="() => {}">
409
+ <Dialog :open="true" @close ="() => {}">
458
410
<DialogDescription v-slot="data">{{JSON.stringify(data)}}</DialogDescription>
459
411
<TabSentinel />
460
412
</Dialog>
@@ -487,7 +439,7 @@ describe('Keyboard interactions', () => {
487
439
<button id="trigger" @click="toggleOpen">
488
440
Trigger
489
441
</button>
490
- <Dialog :open="isOpen" :onClose ="setIsOpen">
442
+ <Dialog :open="isOpen" @close ="setIsOpen">
491
443
Contents
492
444
<TabSentinel />
493
445
</Dialog>
@@ -538,7 +490,7 @@ describe('Mouse interactions', () => {
538
490
<button id="trigger" @click="toggleOpen">
539
491
Trigger
540
492
</button>
541
- <Dialog :open="isOpen" :onClose ="setIsOpen">
493
+ <Dialog :open="isOpen" @close ="setIsOpen">
542
494
<DialogOverlay />
543
495
Contents
544
496
<TabSentinel />
@@ -580,7 +532,7 @@ describe('Mouse interactions', () => {
580
532
template : `
581
533
<div>
582
534
<button @click="isOpen = !isOpen">Trigger</button>
583
- <Dialog :open="isOpen" :onClose ="setIsOpen">
535
+ <Dialog :open="isOpen" @close ="setIsOpen">
584
536
Contents
585
537
<TabSentinel />
586
538
</Dialog>
@@ -622,7 +574,7 @@ describe('Mouse interactions', () => {
622
574
<div>
623
575
<button>Hello</button>
624
576
<button @click="isOpen = !isOpen">Trigger</button>
625
- <Dialog v-if="true" :open="isOpen" :onClose ="setIsOpen">
577
+ <Dialog v-if="true" :open="isOpen" @close ="setIsOpen">
626
578
Contents
627
579
<TabSentinel />
628
580
</Dialog>
0 commit comments