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 { focusInMixin } from './focus-in'
describe('mixins/focus-in', () => {
it('works', async () => {
let count = 0
const App = {
mixins: [focusInMixin],
// listenForFocusIn comes from the mixin
created() {
this.listenForFocusIn = true
},
methods: {
focusInHandler() {
count++
}
},
render(h) {
return h('div', [h('button', 'button')])
}
}
const wrapper = mount(App, {
attachTo: document.body
})
const focusinEvent = new FocusEvent('focusin')
expect(wrapper).toBeDefined()
expect(count).toBe(0)
expect(wrapper.vm.listenForFocusIn).toBe(true)
// When this.listenForFocusIn is true
expect(count).toBe(0)
await wrapper.find('button').trigger('focusin')
expect(count).toBe(1)
document.dispatchEvent(focusinEvent)
await waitNT(wrapper.vm)
expect(count).toBe(2)
// When this.listenForFocusIn is false
await wrapper.setData({ listenForFocusIn: false })
expect(count).toBe(2)
await wrapper.find('button').trigger('focusin')
expect(count).toBe(2)
document.dispatchEvent(focusinEvent)
await waitNT(wrapper.vm)
expect(count).toBe(2)
wrapper.destroy()
})
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0034 ]-- |