![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/node_modules/bootstrap-vue/src/components/form/ |
import { mount } from '@vue/test-utils' import { BForm } from './form' describe('form', () => { it('has expected default structure', async () => { const wrapper = mount(BForm) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes().length).toBe(0) expect(wrapper.text()).toEqual('') wrapper.destroy() }) it('renders default slot content', async () => { const wrapper = mount(BForm, { slots: { default: 'foobar' } }) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes().length).toBe(0) expect(wrapper.attributes('id')).toBeUndefined() expect(wrapper.attributes('novalidate')).toBeUndefined() expect(wrapper.text()).toEqual('foobar') wrapper.destroy() }) it('has class form-inline when prop inline set', async () => { const wrapper = mount(BForm, { propsData: { inline: true } }) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes()).toContain('form-inline') expect(wrapper.classes().length).toBe(1) expect(wrapper.attributes('id')).toBeUndefined() expect(wrapper.attributes('novalidate')).toBeUndefined() expect(wrapper.text()).toEqual('') wrapper.destroy() }) it('has class was-validation when prop validated set', async () => { const wrapper = mount(BForm, { propsData: { validated: true } }) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes()).toContain('was-validated') expect(wrapper.classes().length).toBe(1) expect(wrapper.attributes('id')).toBeUndefined() expect(wrapper.attributes('novalidate')).toBeUndefined() expect(wrapper.text()).toEqual('') wrapper.destroy() }) it('has user supplied id', async () => { const wrapper = mount(BForm, { propsData: { id: 'foo' } }) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes().length).toBe(0) expect(wrapper.attributes('id')).toBeDefined() expect(wrapper.attributes('id')).toEqual('foo') expect(wrapper.attributes('novalidate')).toBeUndefined() expect(wrapper.text()).toEqual('') wrapper.destroy() }) it('has attribute novalidate when prop novalidate set', async () => { const wrapper = mount(BForm, { propsData: { novalidate: true } }) expect(wrapper.element.tagName).toBe('FORM') expect(wrapper.classes().length).toBe(0) expect(wrapper.attributes('id')).toBeUndefined() expect(wrapper.attributes('novalidate')).toBeDefined() expect(wrapper.text()).toEqual('') wrapper.destroy() }) })