test: fix cases

This commit is contained in:
07akioni 2021-09-13 23:43:09 +08:00
parent cf29465775
commit b36cebca25
3 changed files with 15 additions and 21 deletions

View File

@ -80,9 +80,7 @@ describe('n-cascader', () => {
const wrapper = mount(NCascader, {
props: { options: getOptions(), defaultValue: 'l-1-1-2' }
})
expect(wrapper.find('.n-base-selection-label__input').text()).toBe(
'l-1-1-2'
)
expect(wrapper.find('.n-base-selection-input').text()).toBe('l-1-1-2')
})
it('should work with `multiple` prop', async () => {

View File

@ -238,9 +238,7 @@ describe('n-select', () => {
}
})
expect(wrapper.find('.n-base-selection-label__input').text()).toBe(
'render-test'
)
expect(wrapper.find('.n-base-selection-input').text()).toBe('render-test')
await wrapper.setProps({ show: true })
await nextTick()
expect(
@ -266,14 +264,12 @@ describe('n-select', () => {
const wrapper = mount(NSelect)
expect(wrapper.find('input').exists()).not.toBe(true)
expect(wrapper.find('.n-base-selection-label__input').exists()).not.toBe(
true
)
expect(wrapper.find('.n-base-selection-input').exists()).not.toBe(true)
await wrapper.setProps({
filterable: true
})
expect(wrapper.find('input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-label__input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-input').exists()).toBe(true)
})
it('should work with `loading` prop', async () => {
@ -337,6 +333,10 @@ describe('n-select', () => {
}
})
const menuWrapper = wrapper.findComponent(NInternalSelectMenu)
expect(menuWrapper.find('.n-base-select-menu__empty .n-empty').attributes('style')).toContain('--text-color: #4fb233;')
expect(
menuWrapper
.find('.n-base-select-menu__empty .n-empty')
.attributes('style')
).toContain('--text-color: #4fb233;')
})
})

View File

@ -52,24 +52,20 @@ describe('n-tree-select', () => {
defaultValue: '1-2'
}
})
expect(wrapper.find('.n-base-selection-label__input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-label__input').text()).toBe(
'1 / 1-2'
)
expect(wrapper.find('.n-base-selection-input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-input').text()).toBe('1 / 1-2')
await wrapper.setProps({ showPath: false })
expect(wrapper.find('.n-base-selection-label__input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-label__input').text()).toBe('1-2')
expect(wrapper.find('.n-base-selection-input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-input').text()).toBe('1-2')
await wrapper.setProps({
showPath: true,
defaultValue: '1-1',
separator: ' | '
})
expect(wrapper.find('.n-base-selection-label__input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-label__input').text()).toBe(
'1 | 1-2'
)
expect(wrapper.find('.n-base-selection-input').exists()).toBe(true)
expect(wrapper.find('.n-base-selection-input').text()).toBe('1 | 1-2')
})
it('should work with `multiple` prop', () => {