Skip to content

chore: tests cleanup #3018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/components/alert/alert.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Alert from './alert'
import BAlert from './alert'
import { mount } from '@vue/test-utils'

describe('alert', () => {
it('hidden alert renders comment node', async () => {
const wrapper = mount(Alert)
const wrapper = mount(BAlert)
expect(wrapper.isVueInstance()).toBe(true)
await wrapper.vm.$nextTick()
expect(wrapper.isEmpty()).toBe(true)
Expand All @@ -13,7 +13,7 @@ describe('alert', () => {
})

it('hidden alert (show = "0") renders comment node', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: '0'
}
Expand All @@ -27,7 +27,7 @@ describe('alert', () => {
})

it('hidden alert (show = 0) renders comment node', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: 0
}
Expand All @@ -41,7 +41,7 @@ describe('alert', () => {
})

it('visible alert has default class names and attributes', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true
}
Expand All @@ -65,7 +65,7 @@ describe('alert', () => {
})

it('visible alert (show = "") has default class names and attributes', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: ''
}
Expand All @@ -89,7 +89,7 @@ describe('alert', () => {
})

it('visible alert has variant when prop variant is set', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
variant: 'success'
Expand All @@ -110,7 +110,7 @@ describe('alert', () => {
})

it('renders content from default slot', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true
},
Expand All @@ -130,7 +130,7 @@ describe('alert', () => {
})

it('hidden alert shows when show prop set', async () => {
const wrapper = mount(Alert)
const wrapper = mount(BAlert)

expect(wrapper.isVueInstance()).toBe(true)
await wrapper.vm.$nextTick()
Expand All @@ -151,7 +151,7 @@ describe('alert', () => {
})

it('dismissible alert should have class alert-dismissible', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
dismissible: true
Expand All @@ -168,7 +168,7 @@ describe('alert', () => {
})

it('dismissible alert should have close button', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
dismissible: true
Expand All @@ -185,7 +185,7 @@ describe('alert', () => {
})

it('dismissible alert should have close button with custom aria-label', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
dismissible: true,
Expand All @@ -203,7 +203,7 @@ describe('alert', () => {
})

it('dismiss button click should close alert', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
dismissible: true
Expand Down Expand Up @@ -234,13 +234,13 @@ describe('alert', () => {
})

it('should have class fade when prop fade=true', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: true,
fade: true
},
stubs: {
// the builtin stub doesn't execute the transition hooks
// The builtin stub doesn't execute the transition hooks
// so we let it use the real transition component
transition: false
}
Expand All @@ -259,13 +259,13 @@ describe('alert', () => {
})

it('fade transition works', async () => {
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: false,
fade: true
},
stubs: {
// the builtin stub doesn't execute the transition hooks
// The builtin stub doesn't execute the transition hooks
// so we let it use the real transition component
transition: false
}
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('alert', () => {
await wrapper.vm.$nextTick()
await new Promise(resolve => requestAnimationFrame(resolve))

// dismissed wont be emitted unless dismissible=true or show is a number
// Dismissed won't be emitted unless dismissible=true or show is a number
expect(wrapper.emitted('dismissed')).not.toBeDefined()

expect(wrapper.isEmpty()).toBe(true)
Expand All @@ -304,7 +304,7 @@ describe('alert', () => {

it('dismiss countdown emits dismiss-count-down event', async () => {
jest.useFakeTimers()
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: 3
}
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('alert', () => {

it('dismiss countdown emits dismiss-count-down event when show is number as string', async () => {
jest.useFakeTimers()
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: '3'
}
Expand Down Expand Up @@ -378,7 +378,7 @@ describe('alert', () => {

it('dismiss countdown handles when show value is changed', async () => {
jest.useFakeTimers()
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: 2
}
Expand Down Expand Up @@ -430,7 +430,7 @@ describe('alert', () => {

it('dismiss countdown handles when alert dismissed early', async () => {
jest.useFakeTimers()
const wrapper = mount(Alert, {
const wrapper = mount(BAlert, {
propsData: {
show: 2,
dismissible: true
Expand Down
18 changes: 9 additions & 9 deletions src/components/badge/badge.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Badge from './badge'
import BBadge from './badge'
import { mount } from '@vue/test-utils'

describe('badge', () => {
it('should have base classes', async () => {
const wrapper = mount(Badge)
const wrapper = mount(BBadge)
expect(wrapper.is('span')).toBe(true)
expect(wrapper.classes()).toContain('badge')
expect(wrapper.classes()).toContain('badge-secondary')
Expand All @@ -14,7 +14,7 @@ describe('badge', () => {
})

it('should have default slot content', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
slots: {
default: 'foobar'
}
Expand All @@ -30,7 +30,7 @@ describe('badge', () => {
})

it('should apply variant class', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
variant: 'danger'
}
Expand All @@ -44,7 +44,7 @@ describe('badge', () => {
})

it('should apply pill class', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
pill: true
}
Expand All @@ -58,7 +58,7 @@ describe('badge', () => {
})

it('should have active class when prop active set', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
active: true
}
Expand All @@ -72,7 +72,7 @@ describe('badge', () => {
})

it('should have disabled class when prop disabled set', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
disabled: true
}
Expand All @@ -86,7 +86,7 @@ describe('badge', () => {
})

it('renders custom root element', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
tag: 'small'
}
Expand All @@ -100,7 +100,7 @@ describe('badge', () => {
})

it('renders link when href provided', async () => {
const wrapper = mount(Badge, {
const wrapper = mount(BBadge, {
propsData: {
href: '/foo/bar'
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/breadcrumb/breadcrumb-item.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import BreadcrumbItem from './breadcrumb-item'
import BBreadcrumbItem from './breadcrumb-item'
import { mount } from '@vue/test-utils'

describe('breadcrumb-item', () => {
it('has default classes and structure', async () => {
const wrapper = mount(BreadcrumbItem)
const wrapper = mount(BBreadcrumbItem)
expect(wrapper.is('li')).toBe(true)
expect(wrapper.classes()).toContain('breadcrumb-item')
expect(wrapper.classes()).not.toContain('active')
expect(wrapper.classes().length).toBe(1)
})

it('has class active when prop active is set', async () => {
const wrapper = mount(BreadcrumbItem, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
active: true
}
Expand All @@ -23,14 +23,14 @@ describe('breadcrumb-item', () => {
})

it('has link as child', async () => {
const wrapper = mount(BreadcrumbItem)
const wrapper = mount(BBreadcrumbItem)
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, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
href: '/foo/bar'
}
Expand All @@ -41,7 +41,7 @@ describe('breadcrumb-item', () => {
})

it('has child span and class active when prop active is set', async () => {
const wrapper = mount(BreadcrumbItem, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
active: true
}
Expand All @@ -54,7 +54,7 @@ describe('breadcrumb-item', () => {
})

it('has child text content from prop text', async () => {
const wrapper = mount(BreadcrumbItem, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
active: true,
text: 'foobar'
Expand All @@ -68,7 +68,7 @@ describe('breadcrumb-item', () => {
})

it('has child text content from prop html', async () => {
const wrapper = mount(BreadcrumbItem, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
active: true,
html: 'foobar'
Expand All @@ -82,7 +82,7 @@ describe('breadcrumb-item', () => {
})

it('has child text content from default slot', async () => {
const wrapper = mount(BreadcrumbItem, {
const wrapper = mount(BBreadcrumbItem, {
propsData: {
active: true
},
Expand Down
Loading