fix(slots): ensure different branches of dynamic slots have different keys

fix #6202
This commit is contained in:
Evan You
2022-08-30 15:55:09 +08:00
parent 96eb745254
commit 00036bb52c
8 changed files with 69 additions and 20 deletions

View File

@@ -17,6 +17,15 @@ describe('createSlot', () => {
expect(actual).toEqual({ descriptor: slot })
})
it('should attach key', () => {
const dynamicSlot = [{ name: 'descriptor', fn: slot, key: '1' }]
const actual = createSlots(record, dynamicSlot)
const ret = actual.descriptor()
// @ts-ignore
expect(ret.key).toBe('1')
})
it('should add all slots to the record', () => {
const dynamicSlot = [
{ name: 'descriptor', fn: slot },