Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped slots with render function not working like in V1 #578

Closed
lmiller1990 opened this issue May 10, 2021 · 4 comments
Closed

Scoped slots with render function not working like in V1 #578

lmiller1990 opened this issue May 10, 2021 · 4 comments

Comments

@lmiller1990
Copy link
Member

Context:

VTU v1 (unofficially?) supported this:

test('scoped-slots', async () => {
    const wrapper = mount(Button, {
      slots: {
        logo: scope => h('div', { class: 'logo' }, JSON.stringify(scope))
      }
    })
    expect(wrapper.html()).toMatchSnapshot()
  })

But it's not working in this lib.

While this feature was not documented, so it's not technically a breaking change to the public API, it'd be good to match the original behavior as much as possible.

Originally described in more detail: #452 (comment)

@dobromir-hristov
Copy link
Contributor

dobromir-hristov commented May 14, 2021

What do you mean, you have access to the scope props when you pass a function. I have this exact one :D

let assertProps

const wrapper = createWrapper({
      slots: {
        button: (props) => {
          assertProps = props;
          return h('button', { class: 'buttonSlot' }, 'Foo');
        },
      },
    });

@lmiller1990
Copy link
Member Author

lmiller1990 commented May 17, 2021

Hey, long time no talk.

Does this mean the snippet I posted already works? I assumed it did not, based on this discussion here.

@dobromir-hristov
Copy link
Contributor

I use it and it works. I even remember working on it hehe

@lmiller1990
Copy link
Member Author

Neat. Might be good to add this to the docs somewhere with an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants