![]() 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/vreg/node_modules/bootstrap-vue/src/components/breadcrumb/ |
import { mount } from '@vue/test-utils' import { BBreadcrumbItem } from './breadcrumb-item' describe('breadcrumb-item', () => { it('has default classes and structure', async () => { const wrapper = mount(BBreadcrumbItem) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes()).not.toContain('active') expect(wrapper.classes().length).toBe(1) wrapper.destroy() }) it('has class active when prop active is set', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { active: true } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('active') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes().length).toBe(2) wrapper.destroy() }) it('has link as child', async () => { const wrapper = mount(BBreadcrumbItem) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.find('a').exists()).toBe(true) expect(wrapper.find('a').attributes('href')).toBe('#') wrapper.destroy() }) it('has link as child and href', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { href: '/foo/bar' } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.find('a').exists()).toBe(true) expect(wrapper.find('a').attributes('href')).toBe('/foo/bar') wrapper.destroy() }) it('has child span and class active when prop active is set', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { active: true } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('active') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes().length).toBe(2) expect(wrapper.find('span').exists()).toBe(true) wrapper.destroy() }) it('has child text content from prop text', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { active: true, text: 'foobar' } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('active') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes().length).toBe(2) expect(wrapper.text()).toBe('foobar') wrapper.destroy() }) it('has child text content from prop html', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { active: true, html: 'foobar' } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('active') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes().length).toBe(2) expect(wrapper.text()).toBe('foobar') wrapper.destroy() }) it('has child text content from default slot', async () => { const wrapper = mount(BBreadcrumbItem, { propsData: { active: true }, slots: { default: 'foobar' } }) expect(wrapper.element.tagName).toBe('LI') expect(wrapper.classes()).toContain('active') expect(wrapper.classes()).toContain('breadcrumb-item') expect(wrapper.classes().length).toBe(2) expect(wrapper.text()).toBe('foobar') wrapper.destroy() }) })