mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-24 12:45:18 +08:00
test(NProgress): add test (#790)
This commit is contained in:
parent
2de677dd58
commit
cf46ee4d8f
@ -14,4 +14,76 @@ describe('n-progress', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should work with `color`, `rail-color`, `indicator-text-color` prop', async () => {
|
||||
const wrapper = mount(NProgress, {
|
||||
props: {
|
||||
color: 'rgb(51, 51, 51)',
|
||||
'rail-color': 'rgb(68, 68, 68)',
|
||||
'indicator-text-color': 'rgb(85, 85, 85)'
|
||||
},
|
||||
slots: {
|
||||
default: () => 'test'
|
||||
}
|
||||
})
|
||||
expect(
|
||||
wrapper.find('.n-progress-graph-line-fill').attributes('style')
|
||||
).toContain('background-color: rgb(51, 51, 51);')
|
||||
expect(
|
||||
wrapper.find('.n-progress-graph-line-rail').attributes('style')
|
||||
).toContain('background-color: rgb(68, 68, 68);')
|
||||
expect(
|
||||
wrapper.find('.n-progress-custom-content').attributes('style')
|
||||
).toContain('color: rgb(85, 85, 85);')
|
||||
})
|
||||
|
||||
it('should work with `border-radius`, `fill-border-radius` prop', async () => {
|
||||
const wrapper = mount(NProgress, {
|
||||
props: {
|
||||
'border-radius': '12px',
|
||||
'fill-border-radius': '13px'
|
||||
},
|
||||
slots: {
|
||||
default: () => 'test'
|
||||
}
|
||||
})
|
||||
expect(
|
||||
wrapper.find('.n-progress-graph-line-rail').attributes('style')
|
||||
).toContain('border-radius: 12px')
|
||||
expect(
|
||||
wrapper.find('.n-progress-graph-line-fill').attributes('style')
|
||||
).toContain('border-radius: 13px')
|
||||
})
|
||||
|
||||
it('should work with `height` prop', async () => {
|
||||
const wrapper = mount(NProgress, {
|
||||
props: {
|
||||
height: 24
|
||||
}
|
||||
})
|
||||
expect(
|
||||
wrapper.find('.n-progress-graph-line-rail').attributes('style')
|
||||
).toContain('height: 24')
|
||||
})
|
||||
|
||||
it('should work with `processing` prop', async () => {
|
||||
const wrapper = mount(NProgress, {
|
||||
props: {
|
||||
processing: true
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-progress-graph-line-fill').classes()).toContain(
|
||||
'n-progress-graph-line-fill--processing'
|
||||
)
|
||||
})
|
||||
|
||||
it('should work with slot', async () => {
|
||||
const wrapper = mount(NProgress, {
|
||||
slots: {
|
||||
default: () => 'test'
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-progress-custom-content').exists()).toBe(true)
|
||||
expect(wrapper.find('.n-progress-custom-content').text()).toBe('test')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user