From 8cf228fba37207a792c0acae5e4294d122631915 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 11:53:50 -0300 Subject: [PATCH 01/10] Update badge.spec.js --- src/components/badge/badge.spec.js | 139 +++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 36 deletions(-) diff --git a/src/components/badge/badge.spec.js b/src/components/badge/badge.spec.js index 07aabeef7be..df448a5140b 100644 --- a/src/components/badge/badge.spec.js +++ b/src/components/badge/badge.spec.js @@ -1,50 +1,117 @@ -import { loadFixture, testVM } from '../../../tests/utils' - -const variantList = [ - 'secondary', - 'primary', - 'success', - 'info', - 'warning', - 'danger', - 'dark', - 'light' -].map(variant => { - return { ref: `badge_${variant}`, variant } -}) +import Badge from './badge' +import { mount } from '@vue/test-utils' describe('badge', () => { - beforeEach(loadFixture(__dirname, 'badge')) - testVM() + it('should have base classes', async () => { + const wrapper = mount(Badge) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') + expect(wrapper.attributes('href')).not.toBeDefined() + }) - it('should apply variant classes', async () => { - const { - app: { $refs } - } = window + it('should have default slot content', async () => { + const wrapper = mount(Badge, { + slots: { + default: 'foobar' + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.text()).toBe('foobar') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') + expect(wrapper.attributes('href')).not.toBeDefined() + }) - expect($refs.badge_pill).toHaveAllClasses(['badge', 'badge-pill']) + it('should apply variant class', async () => { + const wrapper = mount(Badge, { + propsData: { + variant: 'danger' + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.classes()).toContain('badge-danger') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') + }) - variantList.forEach(({ ref, variant }) => { - const vm = $refs[ref][0] - expect(vm).toHaveAllClasses(['badge', `badge-${variant}`]) + it('should apply pill class', async () => { + const wrapper = mount(Badge, { + propsData: { + pill: true + } }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.classes()).toContain('badge-pill') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') }) - it('should apply secondary class when not passed variant', async () => { - const { - app: { $refs } - } = window + it('should have active class when prop active set', async () => { + const wrapper = mount(Badge, { + propsData: { + active: true + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('disabled') + }) - const vm = $refs.no_props - expect(vm).toHaveClass('badge-secondary') + it('should have disabled class when prop disabled set', async () => { + const wrapper = mount(Badge, { + propsData: { + disabled: true + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.classes()).toContain('disabled') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') }) - it('should not apply pill class when not passed pill boolean prop', async () => { - const { - app: { $refs } - } = window + it('renders custom root element', async () => { + const wrapper = mount(Badge, { + propsData: { + tag: 'small' + } + }) + expect(wrapper.is('small')).toBe(true) + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') + }) - const vm = $refs.no_props - expect(vm).not.toHaveClass('badge-pill') + it('renders link when href provided', async () => { + const wrapper = mount(Badge, { + propsData: { + href: '/foo/bar' + } + }) + expect(wrapper.is('a')).toBe(true) + expect(wrapper.attributes('href')).toBeDefined() + expect(wrapper.attributes('href')).toBe('/foo/bar') + expect(wrapper.classes()).toContain('badge') + expect(wrapper.classes()).toContain('badge-secondary') + expect(wrapper.classes()).not.toContain('badge-pill') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes()).not.toContain('disabled') }) }) From 15063e4d3a63078b6b353f98b91671dec0f024da Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 11:55:42 -0300 Subject: [PATCH 02/10] Delete badge.html --- src/components/badge/fixtures/badge.html | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/components/badge/fixtures/badge.html diff --git a/src/components/badge/fixtures/badge.html b/src/components/badge/fixtures/badge.html deleted file mode 100644 index a0790c54606..00000000000 --- a/src/components/badge/fixtures/badge.html +++ /dev/null @@ -1,17 +0,0 @@ -
-

Example heading - New -

-

Example heading - New -

-
Example heading - New -
-

- {{ variant }} -

-
From 029d3d66466d9863e4952751ecc9cae377895146 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 11:55:52 -0300 Subject: [PATCH 03/10] Delete badge.js --- src/components/badge/fixtures/badge.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/components/badge/fixtures/badge.js diff --git a/src/components/badge/fixtures/badge.js b/src/components/badge/fixtures/badge.js deleted file mode 100644 index 0ee95c1e005..00000000000 --- a/src/components/badge/fixtures/badge.js +++ /dev/null @@ -1,8 +0,0 @@ -window.app = new Vue({ - el: '#app', - data() { - return { - variants: ['secondary', 'primary', 'success', 'info', 'warning', 'danger', 'dark', 'light'] - } - } -}) From e3f6e6266f7c0a5a01524785403b92a947b6fd1d Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 11:57:24 -0300 Subject: [PATCH 04/10] Create breadcrumb-item.spec.js --- .../breadcrumb/breadcrumb-item.spec.js | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/components/breadcrumb/breadcrumb-item.spec.js diff --git a/src/components/breadcrumb/breadcrumb-item.spec.js b/src/components/breadcrumb/breadcrumb-item.spec.js new file mode 100644 index 00000000000..92c51417b90 --- /dev/null +++ b/src/components/breadcrumb/breadcrumb-item.spec.js @@ -0,0 +1,103 @@ +import BreadcrumbItem from './breadcrumb-item' +import { mount } from '@vue/test-utils' + +describe('breadcrumb-item', () => { + it('has default classes and structure', async () => { + const wrapper = mount(BreadcrumbItem) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes()).not.toContain('active') + expect(wrapper.classes().length).toBe(1) + expect(wrapper.attributes('role')).toBeDefined() + expect(wrapper.attributes('role')).toBe('presentation') + }) + + it('has class active when prop active is set', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + active: true + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes().length).toBe(2) + expect(wrapper.attributes('role')).toBeDefined() + expect(wrapper.attributes('role')).toBe('presentation') + }) + + it('has link as child', async () => { + const wrapper = mount(BreadcrumbItem) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.find('a').exists()).toBe(true) + expect(wrapper.find('a').attributes('href')).toBe('#') + }) + + it('has link as child and href', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + href: '/foo/bar' + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.find('a').exists()).toBe(true) + expect(wrapper.find('a').attributes('href')).toBe('/foo/bar') + }) + + it('has child span and class active when prop active is set', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + active: true + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes().length).toBe(2) + expect(wrapper.find('span').exists()).toBe(true) + }) + + it('has child text content from prop text', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + active: true, + text: 'foobar' + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes().length).toBe(2) + expect(wrapper.text()).toBe('foobar') + }) + + it('has child text content from prop html', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + active: true, + html: 'foobar' + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes().length).toBe(2) + expect(wrapper.text()).toBe('foobar') + }) + + it('has child text content from default slot', async () => { + const wrapper = mount(BreadcrumbItem, { + propsData: { + active: true + }, + slots: { + default: 'foobar' + } + }) + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('active') + expect(wrapper.classes()).toContain('breadcrumb-item') + expect(wrapper.classes().length).toBe(2) + expect(wrapper.text()).toBe('foobar') + }) +}) From b9425577706976d76deef4d5d487f508075d6c58 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 11:58:17 -0300 Subject: [PATCH 05/10] Create breadcrumb-link.spec.js --- .../breadcrumb/breadcrumb-link.spec.js | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/components/breadcrumb/breadcrumb-link.spec.js diff --git a/src/components/breadcrumb/breadcrumb-link.spec.js b/src/components/breadcrumb/breadcrumb-link.spec.js new file mode 100644 index 00000000000..248845e2601 --- /dev/null +++ b/src/components/breadcrumb/breadcrumb-link.spec.js @@ -0,0 +1,93 @@ +import BreadcrumbLink from './breadcrumb-link' +import { mount } from '@vue/test-utils' + +describe('breadcrumb-link', () => { + it('has default classes and structure', async () => { + const wrapper = mount(BreadcrumbLink) + expect(wrapper.is('a')).toBe(true) + expect(wrapper.attributes('href')).toBeDefined() + expect(wrapper.attributes('href')).toBe('#') + expect(wrapper.classes().length).toBe(0) + expect(wrapper.attributes('aria-current')).not.toBeDefined() + expect(wrapper.text()).toBe('') + }) + + it('has content from default slot', async () => { + const wrapper = mount(BreadcrumbLink, { + slots: { + default: 'foobar' + } + }) + expect(wrapper.text()).toBe('foobar') + }) + + it('has content from text prop', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + text: 'foobar' + } + }) + expect(wrapper.text()).toBe('foobar') + }) + + it('has content from html prop', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + html: 'foobar' + } + }) + expect(wrapper.text()).toBe('foobar') + }) + + it('has attribute aria-current when active', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + active: true + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.attributes('href')).not.toBeDefined() + expect(wrapper.attributes('aria-current')).toBe('location') + expect(wrapper.classes().length).toBe(0) + }) + + it('has attribute aria-current with custom value when active', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + active: true, + ariaCurrent: 'foobar' + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.attributes('aria-current')).toBe('foobar') + expect(wrapper.attributes('href')).not.toBeDefined() + expect(wrapper.classes().length).toBe(0) + }) + + it('renders link when href is set', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + href: '/foo/bar' + } + }) + expect(wrapper.is('a')).toBe(true) + expect(wrapper.attributes('href')).toBeDefined() + expect(wrapper.attributes('href')).toBe('/foo/bar') + expect(wrapper.attributes('aria-current')).not.toBeDefined() + expect(wrapper.classes().length).toBe(0) + }) + + it('does not render a link when href is set and active', async () => { + const wrapper = mount(BreadcrumbLink, { + propsData: { + active: true, + href: '/foo/bar' + } + }) + expect(wrapper.is('span')).toBe(true) + expect(wrapper.attributes('href')).not.toBeDefined() + expect(wrapper.attributes('aria-current')).toBeDefined() + expect(wrapper.attributes('aria-current')).toBe('location') + expect(wrapper.classes().length).toBe(0) + }) +}) From 71531fa335cade7b5ed45be35372c1ac1d7bb763 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 12:18:19 -0300 Subject: [PATCH 06/10] Update breadcrumb.spec.js --- src/components/breadcrumb/breadcrumb.spec.js | 243 ++++++++++++------- 1 file changed, 158 insertions(+), 85 deletions(-) diff --git a/src/components/breadcrumb/breadcrumb.spec.js b/src/components/breadcrumb/breadcrumb.spec.js index 5b468c1b83f..d7d64fb38ad 100644 --- a/src/components/breadcrumb/breadcrumb.spec.js +++ b/src/components/breadcrumb/breadcrumb.spec.js @@ -1,103 +1,176 @@ -import { loadFixture, testVM } from '../../../tests/utils' +import Breadcrumb from './breadcrumb' +import { mount } from '@vue/test-utils' describe('breadcrumb', () => { - beforeEach(loadFixture(__dirname, 'breadcrumb')) - testVM() + it('should have expected default structure', async () => { + const wrapper = mount(Breadcrumb) - it('should apply Bootstrap breadcrumb classes', async () => { - const { - app: { $refs } - } = window - const $ol = $refs.breadcrumb1 - - expect($ol.classList.contains('breadcrumb')).toBe(true) - - Array.from($ol.children).forEach($li => { - if ($li.tagName === 'LI') { - expect($li.classList.contains('breadcrumb-item')).toBe(true) - } - }) + expect(wrapper.is('ol')).toBe(true) + expect(wrapper.classes()).toContain('breadcrumb') + expect(wrapper.classes().length).toBe(1) + expect(wrapper.text()).toBe('') }) - it('should apply ARIA roles', async () => { - const { - app: { $refs } - } = window - const $ol = $refs.breadcrumb1 - - Array.from($ol.children).forEach($li => { - if ($li.tagName === 'LI') { - expect($li.getAttribute('role')).toBe('presentation') + it('should render default slot when no items provided', async () => { + const wrapper = mount(Breadcrumb, { + slots: { + default: 'foobar' } }) + + expect(wrapper.is('ol')).toBe(true) + expect(wrapper.classes()).toContain('breadcrumb') + expect(wrapper.classes().length).toBe(1) + expect(wrapper.text()).toBe('foobar') }) - it('should apply active class to active item', async () => { - const { - app: { - $refs: { breadcrumb2: crumb2 }, - items2 - } - } = window - - items2.forEach((item, i) => { - if (item.active) { - expect(crumb2.children[i].classList.contains('active')).toBe(true) + it ('should accpet items', () => { + const wrapper = mount(Breadcrumb, { + propsData: { + items: [ + { text: 'Home', href: '/' }, + { text: 'Admin', to: '/admin', active: false }, + { html: 'Manage', href: '/admin/manage' }, + // Test with non object + 'Library' + ] } }) + + expect(wrapper.is('ol')).toBe(true) + expect(wrapper.classes()).toContain('breadcrumb') + expect(wrapper.classes().length).toBe(1) + expect(wrapper.findAll('li').length).toBe(4) + expect(wrapper.findAll('li.breadcrumb-item').length).toBe(4) + const $lis = wrapper.findAll('li') + + // HREF testing + expect ( + $lis + .at(0) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(0) + .find('a') + .attributes('href') + ).toBe('/') + expect ($lis.at(0).text()).toBe('Home') + + expect ( + $lis + .at(1) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(1) + .find('a') + .attributes('href') + ).toBe('/admin') + expect ($lis.at(1).text()).toBe('Admin') + + expect ( + $lis + .at(2) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(2) + .find('a') + .attributes('href') + ).toBe('/admin/manage') + expect ($lis.at(1).text()).toBe('Manage') + + // last item should have active state + expect ($lis.at(3).classes()).toContain('active') + expect ( + $lis + .at(3) + .find('span') + .exists() + ).toBe(true) + expect ($lis.at(3).text()).toBe('Library') }) - it('should apply aria-current to active class element', async () => { - const { - app: { - $refs: { breadcrumb2: crumb2 }, - items2 - } - } = window - const $listItems = Array.from(crumb2.children) - - items2.forEach((item, i) => { - if (item.active) { - expect($listItems[i].firstElementChild.hasAttribute('aria-current')).toBe(true) - } else { - expect($listItems[i].firstElementChild.hasAttribute('aria-current')).toBe(false) + it('should apply active class to active item', async () => { + const wrapper = mount(Breadcrumb, { + propsData: { + items: [ + { text: 'Home', href: '/' }, + { text: 'Admin', to: '/admin', active: true }, + { html: 'Manage', href: '/admin/manage' }, + { text: 'Library', href: '/admin/manage/library' } + ] } }) - }) - - it('should default active class to last item only when no true active prop provided', async () => { - const { - app: { - $refs: { breadcrumb1: crumb }, - items - } - } = window - const $listItems = Array.from(crumb.children) - const itemsLength = items.length - - items.forEach((item, i) => { - const isLast = i === itemsLength - 1 - if (isLast) { - expect($listItems[i].classList.contains('active')).toBe(true) - } else { - expect($listItems[i].classList.contains('active')).toBe(false) - } - }) + + expect(wrapper.is('ol')).toBe(true) + expect(wrapper.classes()).toContain('breadcrumb') + expect(wrapper.classes().length).toBe(1) + expect(wrapper.findAll('li').length).toBe(4) + expect(wrapper.findAll('li.breadcrumb-item').length).toBe(4) + const $lis = wrapper.findAll('li') + + // HREF testing + expect ( + $lis + .at(0) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(0) + .find('a') + .attributes('href') + ).toBe('/') + expect ($lis.at(0).text()).toBe('Home') + + // This one should be a span/active + expect ( + $lis + .at(1) + .find('span') + .exists() + ).toBe(true) + expect ($lis.at(1).classes()).toContain('active') + expect ($lis.at(1).text()).toBe('Admin') + + expect ( + $lis + .at(2) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(2) + .find('a') + .attributes('href') + ).toBe('/admin/manage') + expect ($lis.at(1).text()).toBe('Manage') + + // last item should have active state + expect ($lis.at(3).classes()).not.toContain('active') + expect ( + $lis + .at(3) + .find('a') + .exists() + ).toBe(true) + expect ( + $lis + .at(2) + .find('a') + .attributes('href') + ).toBe('/admin/manage/library') + expect ($lis.at(3).text()).toBe('Library') }) - - // TODO: FC's can't emit events, so what to do here? - // it("should emit a click event with the item when clicked", async () => { - // const { app: { $refs, $el } } = window - // const vm = $refs.breadcrumb2 - // const spy = jest.fn() - - // vm.$on("click", spy) - // const $listItems = Array.from(vm.$el.children) - - // app.items2.forEach((item, index) => { - // $listItems[index].click() - // expect(spy).toHaveBeenCalledWith(item) - // }) - // }) }) From e4152796bd8abd9b3b56cab3f0ad7397108450e7 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 12:38:02 -0300 Subject: [PATCH 07/10] Update breadcrumb.spec.js --- src/components/breadcrumb/breadcrumb.spec.js | 57 ++++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/components/breadcrumb/breadcrumb.spec.js b/src/components/breadcrumb/breadcrumb.spec.js index d7d64fb38ad..c89b2cd609e 100644 --- a/src/components/breadcrumb/breadcrumb.spec.js +++ b/src/components/breadcrumb/breadcrumb.spec.js @@ -17,14 +17,14 @@ describe('breadcrumb', () => { default: 'foobar' } }) - + expect(wrapper.is('ol')).toBe(true) expect(wrapper.classes()).toContain('breadcrumb') expect(wrapper.classes().length).toBe(1) expect(wrapper.text()).toBe('foobar') }) - it ('should accpet items', () => { + it('should accpet items', () => { const wrapper = mount(Breadcrumb, { propsData: { items: [ @@ -36,7 +36,7 @@ describe('breadcrumb', () => { ] } }) - + expect(wrapper.is('ol')).toBe(true) expect(wrapper.classes()).toContain('breadcrumb') expect(wrapper.classes().length).toBe(1) @@ -45,57 +45,57 @@ describe('breadcrumb', () => { const $lis = wrapper.findAll('li') // HREF testing - expect ( + expect( $lis .at(0) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis .at(0) .find('a') .attributes('href') ).toBe('/') - expect ($lis.at(0).text()).toBe('Home') + expect($lis.at(0).text()).toBe('Home') - expect ( + expect( $lis .at(1) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis .at(1) .find('a') .attributes('href') ).toBe('/admin') - expect ($lis.at(1).text()).toBe('Admin') + expect($lis.at(1).text()).toBe('Admin') - expect ( + expect( $lis .at(2) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis .at(2) .find('a') .attributes('href') ).toBe('/admin/manage') - expect ($lis.at(1).text()).toBe('Manage') + expect($lis.at(2).text()).toBe('Manage') // last item should have active state expect ($lis.at(3).classes()).toContain('active') - expect ( + expect( $lis .at(3) .find('span') .exists() ).toBe(true) - expect ($lis.at(3).text()).toBe('Library') + expect($lis.at(3).text()).toBe('Library') }) it('should apply active class to active item', async () => { @@ -110,7 +110,6 @@ describe('breadcrumb', () => { } }) - expect(wrapper.is('ol')).toBe(true) expect(wrapper.classes()).toContain('breadcrumb') expect(wrapper.classes().length).toBe(1) @@ -119,58 +118,58 @@ describe('breadcrumb', () => { const $lis = wrapper.findAll('li') // HREF testing - expect ( + expect( $lis .at(0) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis .at(0) .find('a') .attributes('href') ).toBe('/') - expect ($lis.at(0).text()).toBe('Home') + expect($lis.at(0).text()).toBe('Home') // This one should be a span/active - expect ( + expect( $lis .at(1) .find('span') .exists() ).toBe(true) - expect ($lis.at(1).classes()).toContain('active') - expect ($lis.at(1).text()).toBe('Admin') + expect($lis.at(1).classes()).toContain('active') + expect($lis.at(1).text()).toBe('Admin') - expect ( + expect( $lis .at(2) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis .at(2) .find('a') .attributes('href') ).toBe('/admin/manage') - expect ($lis.at(1).text()).toBe('Manage') + expect($lis.at(2).text()).toBe('Manage') // last item should have active state - expect ($lis.at(3).classes()).not.toContain('active') - expect ( + expect($lis.at(3).classes()).not.toContain('active') + expect( $lis .at(3) .find('a') .exists() ).toBe(true) - expect ( + expect( $lis - .at(2) + .at(3) .find('a') .attributes('href') ).toBe('/admin/manage/library') - expect ($lis.at(3).text()).toBe('Library') + expect($lis.at(3).text()).toBe('Library') }) }) From e7621379aa2fa275a7c6214e2daa7dcb124f7546 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 12:42:39 -0300 Subject: [PATCH 08/10] lint --- src/components/breadcrumb/breadcrumb.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/breadcrumb/breadcrumb.spec.js b/src/components/breadcrumb/breadcrumb.spec.js index c89b2cd609e..52547ff72d0 100644 --- a/src/components/breadcrumb/breadcrumb.spec.js +++ b/src/components/breadcrumb/breadcrumb.spec.js @@ -88,7 +88,7 @@ describe('breadcrumb', () => { expect($lis.at(2).text()).toBe('Manage') // last item should have active state - expect ($lis.at(3).classes()).toContain('active') + expect($lis.at(3).classes()).toContain('active') expect( $lis .at(3) From 79895d53d9fd3042f165227a5ed9aedc4eb77502 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 12:47:32 -0300 Subject: [PATCH 09/10] Delete breadcrumb.html --- src/components/breadcrumb/fixtures/breadcrumb.html | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/components/breadcrumb/fixtures/breadcrumb.html diff --git a/src/components/breadcrumb/fixtures/breadcrumb.html b/src/components/breadcrumb/fixtures/breadcrumb.html deleted file mode 100644 index 9a5c39c5f3a..00000000000 --- a/src/components/breadcrumb/fixtures/breadcrumb.html +++ /dev/null @@ -1,11 +0,0 @@ -
- - - - - - - -
From 8bdb75d91fab5b0d888e48996de300c07445eb59 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 27 Mar 2019 12:47:40 -0300 Subject: [PATCH 10/10] Delete breadcrumb.js --- .../breadcrumb/fixtures/breadcrumb.js | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 src/components/breadcrumb/fixtures/breadcrumb.js diff --git a/src/components/breadcrumb/fixtures/breadcrumb.js b/src/components/breadcrumb/fixtures/breadcrumb.js deleted file mode 100644 index 7f6797bc2f5..00000000000 --- a/src/components/breadcrumb/fixtures/breadcrumb.js +++ /dev/null @@ -1,58 +0,0 @@ -window.app = new Vue({ - el: '#app', - data: { - items: [ - { - text: 'Home', - href: 'https://bootstrap-vue.github.io' - }, - { - text: 'Admin', - href: '#', - active: false - }, - { - text: 'Manage', - href: '#' - }, - // Test with non object - 'Library' - ], - items2: [ - { - text: 'Home', - href: 'https://bootstrap-vue.github.io' - }, - { - text: 'Admin', - href: '#', - active: true - }, - { - text: 'Manage', - href: '#' - }, - { - text: 'Library' - } - ], - items3: [ - { - text: 'Home', - href: 'https://bootstrap-vue.github.io' - }, - { - text: 'Admin', - href: '#', - active: true - }, - { - text: 'Manage', - href: '#' - }, - { - text: 'Library' - } - ] - } -})