Skip to content

Commit

Permalink
fix(components): [select] collapse-tags-tooltip drop first item (elem…
Browse files Browse the repository at this point in the history
…ent-plus#8344)

* fix(components): [select] collapse-tag-tooltip drop first item

* fix(components): [select] collapse-tags-tooltip drop first item test
  • Loading branch information
chenxch authored and LinZhanMing committed Jun 18, 2022
1 parent 720a688 commit be30caf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/components/select-v2/__tests__/select.test.ts
Expand Up @@ -651,7 +651,7 @@ describe('Select', () => {
options[2].click()
await nextTick()
expect(vm.value.length).toBe(3)
expect(wrapper.findAll('.el-tag')[4].element.textContent).toBe('c2')
expect(wrapper.findAll('.el-tag')[3].element.textContent).toBe('c2')
})
})

Expand Down
4 changes: 3 additions & 1 deletion packages/components/select-v2/src/select.vue
Expand Up @@ -86,7 +86,9 @@
<template #content>
<div :class="nsSelectV2.e('selection')">
<div
v-for="(selected, idx) in states.cachedOptions"
v-for="(selected, idx) in states.cachedOptions.slice(
1
)"
:key="idx"
:class="nsSelectV2.e('selected-item')"
>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/select/__tests__/select.test.ts
Expand Up @@ -1074,8 +1074,8 @@ describe('Select', () => {
const triggerWrappers = wrapper.findAll('.el-tooltip__trigger')
expect(triggerWrappers[0]).toBeDefined()
const tags = wrapper.findAll('.el-select__tags-text')
expect(tags.length).toBe(5)
expect(tags[4].element.textContent).toBe('蚵仔煎')
expect(tags.length).toBe(4)
expect(tags[3].element.textContent).toBe('蚵仔煎')
})

test('multiple remove-tag', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/select/src/select.vue
Expand Up @@ -73,7 +73,7 @@
<template #content>
<div :class="nsSelect.e('collapse-tags')">
<div
v-for="(item, idx) in selected"
v-for="(item, idx) in selected.slice(1)"
:key="idx"
:class="nsSelect.e('collapse-tag')"
>
Expand Down

0 comments on commit be30caf

Please sign in to comment.