mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-04-06 01:25:31 +00:00
add ProgressBar tests
This commit is contained in:
parent
d15a1a8105
commit
61cb7dd7c2
65
webapp/components/ProgressBar/ProgressBar.spec.js
Normal file
65
webapp/components/ProgressBar/ProgressBar.spec.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import ProgressBar from './ProgressBar'
|
||||||
|
|
||||||
|
describe('ProgessBar.vue', () => {
|
||||||
|
let propsData
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData = {
|
||||||
|
goal: 50000,
|
||||||
|
progress: 10000,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const Wrapper = () => mount(ProgressBar, { propsData })
|
||||||
|
|
||||||
|
describe('given only goal and progress', () => {
|
||||||
|
it('renders no title', () => {
|
||||||
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__title')
|
||||||
|
.exists(),
|
||||||
|
).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders no label', () => {
|
||||||
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__label')
|
||||||
|
.exists(),
|
||||||
|
).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calculates the progress bar width as a percentage of the goal', () => {
|
||||||
|
expect(Wrapper().vm.progressBarWidth).toBe('width: 20%;')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('given a title', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData.title = 'This is progress'
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the title', () => {
|
||||||
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__title')
|
||||||
|
.text(),
|
||||||
|
).toBe('This is progress')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('given a label', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
propsData.label = 'Going well'
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the label', () => {
|
||||||
|
expect(
|
||||||
|
Wrapper()
|
||||||
|
.find('.progress-bar__label')
|
||||||
|
.text(),
|
||||||
|
).toBe('Going well')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user