+49
-1
lines changedFilter options
+49
-1
lines changed Original file line number Diff line number Diff line change
@@ -146,7 +146,8 @@ export const BOverlay = /*#__PURE__*/ Vue.extend({
146
146
'position-absolute': !this.noWrap || (this.noWrap && !this.fixed),
147
147
'position-fixed': this.noWrap && this.fixed
148
148
},
149
-
style: { ...positionCover, zIndex: this.zIndex || 10 }
149
+
style: { ...positionCover, zIndex: this.zIndex || 10 },
150
+
on: { click: evt => this.$emit('click', evt) }
150
151
},
151
152
[$background, $content]
152
153
)
Original file line number Diff line number Diff line change
@@ -170,6 +170,41 @@ describe('overlay', () => {
170
170
wrapper.destroy()
171
171
})
172
172
173
+
it('emits event when overlay clicked', async () => {
174
+
const wrapper = mount(BOverlay, {
175
+
propsData: {
176
+
show: true
177
+
},
178
+
slots: {
179
+
default: '<span>foobar</span>'
180
+
}
181
+
})
182
+
183
+
expect(wrapper.isVueInstance()).toBe(true)
184
+
await waitNT(wrapper.vm)
185
+
await waitRAF()
186
+
await waitNT(wrapper.vm)
187
+
await waitRAF()
188
+
189
+
expect(wrapper.is('div')).toBe(true)
190
+
expect(wrapper.classes()).toContain('b-overlay-wrap')
191
+
192
+
const $overlay = wrapper.find('.b-overlay')
193
+
expect($overlay.exists()).toBe(true)
194
+
195
+
expect(wrapper.emitted('click')).not.toBeDefined()
196
+
197
+
$overlay.trigger('click')
198
+
await waitNT(wrapper.vm)
199
+
200
+
expect(wrapper.emitted('click')).toBeDefined()
201
+
expect(wrapper.emitted('click').length).toBe(1)
202
+
expect(wrapper.emitted('click')[0][0]).toBeInstanceOf(Event)
203
+
expect(wrapper.emitted('click')[0][0].type).toEqual('click')
204
+
205
+
wrapper.destroy()
206
+
})
207
+
173
208
it('has expected default structure when `no-wrap` is set', async () => {
174
209
const wrapper = mount(BOverlay, {
175
210
propsData: {
Original file line number Diff line number Diff line change
@@ -76,6 +76,18 @@
76
76
}
77
77
],
78
78
"events": [
79
+
{
80
+
"event": "click",
81
+
"version": "2.13.0",
82
+
"description": "Emitted when overlay is clicked",
83
+
"args": [
84
+
{
85
+
"arg": "event",
86
+
"type": "MouseEvent",
87
+
"description": "Native click event object"
88
+
}
89
+
]
90
+
},
79
91
{
80
92
"event": "shown",
81
93
"description": "Emitted when the overlay has been shown"
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4