Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
expect(p).toBeDefined()
expect(p).toBeInstanceOf(Promise)
await waitNT(wrapper.vm)
await waitRAF()
await waitNT(wrapper.vm)
await waitRAF()
await waitNT(wrapper.vm)
await waitRAF()
// Find the modal
const modal = document.querySelector('#test2')
expect(modal).toBeDefined()
expect(modal).not.toEqual(null)
const $modal = createWrapper(modal)
expect($modal.is('div')).toBe(true)
// Find the OK button and click it
expect($modal.findAll('button').length).toBe(1)
const $button = $modal.find('button')
expect($button.text()).toEqual('OK')
$button.trigger('click')
// Promise should now resolve
const result = await p
expect(result).toEqual(true)
await waitNT(wrapper.vm)
await waitRAF()
await waitNT(wrapper.vm)
await waitRAF()
title: 'title',
noAutoHide: true
})
await waitNT(wrapper.vm)
await waitRAF()
await waitNT(wrapper.vm)
await waitRAF()
await waitNT(wrapper.vm)
await waitRAF()
// Find the toast
const toast = document.querySelector('#test2')
expect(toast).toBeDefined()
expect(toast).not.toEqual(null)
const $toast = createWrapper(toast)
expect($toast.is('div')).toBe(true)
// Find header
expect($toast.find('.toast-header').exists()).toBe(true)
expect($toast.find('.toast-header').text()).toContain('title')
// Find body
expect($toast.find('.toast-body').exists()).toBe(true)
expect($toast.find('.toast-body').text()).toContain('message')
// Find the Close button and click it
expect($toast.findAll('button').length).toBe(1)
const $button = $toast.find('button')
expect($button.classes()).toContain('close')
$button.trigger('click')
const wrapper = mount(BCollapse, {
attachToDocument: true,
propsData: {
// 'id' is a required prop
id: 'test',
visible: true
},
slots: {
default: '<div>foobar</div>'
},
stubs: {
// Disable use of default test transitionStub component
transition: false
}
})
const rootWrapper = createWrapper(wrapper.vm.$root)
await waitNT(wrapper.vm)
await waitRAF()
expect(wrapper.emitted('show')).not.toBeDefined() // Does not emit show when initially visible
expect(wrapper.emitted('input')).toBeDefined()
expect(wrapper.emitted('input').length).toBe(1)
expect(wrapper.emitted('input')[0][0]).toBe(true)
expect(rootWrapper.emitted(EVENT_ACCORDION)).not.toBeDefined()
expect(rootWrapper.emitted(EVENT_STATE)).toBeDefined()
expect(rootWrapper.emitted(EVENT_STATE).length).toBe(1)
expect(rootWrapper.emitted(EVENT_STATE)[0][0]).toBe('test') // ID
expect(rootWrapper.emitted(EVENT_STATE)[0][1]).toBe(true) // Visible state
expect(wrapper.element.style.display).toEqual('')
wrapper.destroy()
})
it('closes tooltip when dropdown opens', done => {
wrapper.find('.more-actions-toggle').trigger('click');
const rootWrapper = createWrapper(wrapper.vm.$root);
Vue.nextTick()
.then(() => {
const emitted = Object.keys(rootWrapper.emitted());
expect(emitted).toEqual(['bv::hide::tooltip']);
done();
})
.catch(done.fail);
});
});
it('closes tooltip when dropdown opens', (done) => {
wrapper.find('.more-actions-toggle').trigger('click');
const rootWrapper = createWrapper(wrapper.vm.$root);
Vue.nextTick()
.then(() => {
const emitted = Object.keys(rootWrapper.emitted());
expect(emitted).toEqual([BV_HIDE_TOOLTIP]);
done();
})
.catch(done.fail);
});
const getByText = (text, options) =>
createWrapper(getByTextHelper(wrapper.element, text, options));
const getByText = (text, options) =>
createWrapper(getByTextHelper(wrapper.element, text, options));
const getByText = (text, options) =>
createWrapper(within(wrapper.element).getByText(text, options));
const setup = () => {
vm = initMembersApp(el, {
[MEMBER_TYPES.user]: {
tableFields: ['account'],
tableAttrs: { table: { 'data-qa-selector': 'members_list' } },
tableSortableFields: ['account'],
requestFormatter: () => ({}),
filteredSearchBar: { show: false },
},
});
wrapper = createWrapper(vm);
};
const getByText = (text, options) =>
createWrapper(getByTextHelper(wrapper.element, text, options));