Skip to content

scopedSlots as Function returns only first element from array: res[0] #1757

Open
@voskresla

Description

@voskresla

Subject of the issue

We can't use code like this:

wrapper = mount(Tag, {
	scopedSlots: {
		myScoped() {
			return [
				<div id="v-slot">Click in this must return 0 in console</div>,
				<div id="v-slot">Click in this must return 1 in console</div>
			]
		}
	}
})

Steps to reproduce

https://gitlab.com/vskrsl/vtu-issue-scopedslots-array

I try to describe more about use case in test file. And example in native vue (instead tsx) how i can solve this.

Expected behaviour

I expected that all slots will be rendered not only first.

Actual behaviour

Because we have check on string https://github.com/vuejs/vue-test-utils/blob/dev/packages/create-instance/create-scoped-slots.js#L126 we got only first element of scopedSlots array (res[0])

Possible Solution

Does we realy still need this check for return result ? If i delete this check and will always return return res all internal VTU test passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions