Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/inventory.picotech.app/public_html/node_modules/bootstrap-vue/src/mixins/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { mount } from '@vue/test-utils'
import { waitNT } from '../../tests/utils'
import { clickOutMixin } from './click-out'
describe('utils/click-out', () => {
it('works', async () => {
let count = 0
const App = {
mixins: [clickOutMixin],
// `listenForClickOut` comes from the mixin data
created() {
this.listenForClickOut = true
},
methods: {
clickOutHandler() {
count++
}
},
render(h) {
return h('div', [h('button', 'button')])
}
}
const wrapper = mount(App, {
attachTo: document.body
})
const clickEvent = new MouseEvent('click')
expect(wrapper).toBeDefined()
expect(count).toBe(0)
expect(wrapper.vm.listenForClickOut).toBe(true)
// When `this.listenForClickOut` is `true`
expect(count).toBe(0)
await wrapper.find('button').trigger('click')
expect(count).toBe(0)
await wrapper.trigger('click')
expect(count).toBe(0)
document.dispatchEvent(clickEvent)
await waitNT(wrapper.vm)
expect(count).toBe(1)
// When `this.listenForClickOut` is `false`
await wrapper.setData({ listenForClickOut: false })
document.dispatchEvent(clickEvent)
await waitNT(wrapper.vm)
expect(count).toBe(1)
wrapper.destroy()
})
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0033 ]-- |